Linux/Unix-head命令

时间:2019-08-20 17:58:11  来源:igfitidea点击:

Head命令广泛用于系统管理。顾名思义,它用于显示文件的头部信息。

如何使用head命令

不使用任何选项与头部命令。默认它将打印文件的前10行。

语法:

head option filename

打印前n行

使用-n选项打印文件的前n行。

Hyman@theitroad:/partition9$ head -n 4 changelog.txt 
mozillux v12.12.1
- fixed a bug on java7, preventing the update
- java7 update to latest stable release with new setting tools
- fixed a bug on resonant/mumble server startup
Hyman@theitroad:/partition9$

也可以取消字符n,例如:

Hyman@theitroad:/partition9$ head -6 changelog.txt 
mozillux v12.12.1
- fixed a bug on java7, preventing the update
- java7 update to latest stable release with new setting tools
- fixed a bug on resonant/mumble server startup
- fixed locale bug, live-dvd now default to english
- added drum machine and sound mixer
Hyman@theitroad:/partition9$