The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

head - Read the Beginning of a File

Compared to cat, which reads the entire content of a file, head by default only reads the first 10 lines of a text file.

The syntax of the head command is as follows:
head [OPTIONS] [FILE] .

Some common options for the head command include:



Example:
head FILE ←Reads the first 10 lines of the file "FILE."
head -n 50 FILE1 > FILE2 ←Saves the first 50 lines of "FILE1" as a new file named "FILE2."
ls --help | head ←Displays only the first 10 lines of the online manual for the "ls" command.


For more detailed options and parameters, please refer to the link provided