--- layout: page author: Agostino Monti category-page: advanced category-title: Advanced commands tags: head tail text file title: head-tail ---

head

The head command reads the first few lines of any text given to it as an input and writes them to standard output. If more than one input file is provided, head will return the first ten lines from each file, precede each set of lines by the name of the file and separate each set of lines by one vertical space.


tail

The tail command is similar to the head command except that it reads the final lines in files rather than the first lines.

Examples

      head file1.txt 
head file1.txt file2.txt
tail fail1.txt

flags