English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux head Command

Linux Command大全

The head command can be used to view the beginning part of the file content, and it has a commonly used parameter -n Used to display line numbers, the default is 10That is, display 10 The content of the line.

Command Format:

head [parameters] [files]

Parameters:

  • -q Hides the filename

  • -v Displays the filename

  • -c<number of bytes> Displays the number of bytes.

  • -n<line number> Displays the number of lines.

Example

To display w3The beginning of the codebox_notes.log file 10 Enter the following command to display

head w3codebox_notes.log

Display the beginning of the notes.log file 5 Enter the following command to display

head -n 5 w3codebox_notes.log

Display the beginning of the file 20 Bytes:

head -c 20 w3codebox_notes.log

Linux Command大全