Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

up vote 5 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

 
discard

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.