Linux common commands-15: head

The head command is used to display the content of the file. Similar to cat , the first 10 lines of the file are printed by default when no parameters are accepted.

Syntax format: head [parameter] [file]

Common parameters:

Example

 # 默认显示head test.txt # 显示文件的前20行head -n 20 test.txt # 显示文件的前20个字符,注意和行的区别head -c 20 test.txt

This article is reprinted from https://xugaoxiang.com/2022/06/03/linux-cmds-15-head/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment