Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm used to commands supporting multiple filename arguments if possible, but unlink doesn't:

%> unlink a b
unlink: extra operand `b'
Try `unlink --help' for more information.

I ended up using a for loop. Is there a technical reason why unlink only takes one filename?

share|improve this question
up vote 6 down vote accepted

unlink(1) is an intentionally simplified variant of rm(1).

I'm not certain why it was created, but it's probably due to the fact that under the hood, rm(1) is implemented in terms of the unlink(2) system call. Therefore, I assume the reason for unlink(1) is to provide a more direct path to the system call. Someone doubtless came up with a use case where rm(1) did the wrong thing and decided the best way to fix it was to provide this direct path.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.