Question: Linux provides a command-line utility rm that has the purpose ofremoving a file from a directory. When executing rm inside of the strace utility we

Linux provides a command-line utility rm that has the purpose ofremoving a file from a directory.

When executing rm inside of the strace utility we can see thatrm makes a system call to unlink().

Here is an example.

$ strace rm test.txt

... unlinkat(AT_FDCWD, "test.txt", 0) = 0

Question :

Explain why rm unlinks the file. How does unlinkingresult in the removal of the file? and

Why does Linux not have a system call such as delete()that rm could use to directly remove the file?

Step by Step Solution

3.50 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

In Unixlike operating systems a file is not simply stored in a directory like it is in some other op... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!