While the head and tail commands are related, they are separate commands that work in opposite ways. By default, the head filename command looks at the first 10 lines of a file, and the tail filename command looks at the last 10 lines of a file. You can specify a different number of lines with the -nxy switch. For example, the tail -n15 /etc/passwd command lists the last 15 lines of the /etc/passwd file.
The tail -f logfile command is commonly used as a way to monitor log messages as they appear. It's often used with files in the /var/log directory.
Was this article helpful?