Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm interested in why head works as it works with given parameters, i.e. head -3 produces the same output as head -n 3?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

From the Coreutils info pages for head (accessible through info coreutils 'head invocation'):

For compatibility head also supports an obsolete option syntax -COUNTOPTIONS, which is recognized only if it is specified first. COUNT is a decimal number optionally followed by a size letter (b, k, m) as in -c, or l to mean count by lines, or other option letters (cqv). Scripts intended for standard hosts should use -c COUNT or -n COUNT instead.

This is why the syntax is equivalent. man head doesn't tell you this, by the way.

share|improve this answer
add comment

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.