- option you're reading from "standard input". From the manpage of
when FILE is -, read standard input.
Your keyboard is the standard input in this case, as your shell doesn't provide another to
head here. Everytime you provide a line, it will just process it up to 10 times as it's outputting the first 10 lines by default. As your shell will also print the input you provide, you'll see all lines twice.
When you are providing a stream to the standard input to
head, then your keyboard input will not be grabbed. E.g.:
echo blaat | head -
echo output "blaat" to standard output and your shell will connect that to standard input of
head (as expressed by the
Note: Without any arguments given
head will also read from standard input.
A more useful (random) example for the use in connecting up standard input with head is this:
grep error /var/log/syslog | grep -iv apache | head
Will print the first 10 lines matching
error, but not