Linux 管理员 - head 命令

head 与 tail 基本相反,与执行文件操作的部分有关。默认情况下,head 将读取文件的前 10 行。

head 提供与 tail − 类似的选项

开关 操作
-c 以千字节为单位输出最后的内容
-n 从 eof 输出 n 行
-q 没有标题,只有文件内容

注意 − Head 不提供 -f 选项,因为文件是从底部附加的。

head 对于阅读配置文件的描述很有用。在制作这样的文件时,最好有效地使用前 10 行。

[root@centosLocal centos]# head /etc/sudoers 
## Sudoers allows particular users to run various commands as 
## the root user, without needing the root password. 
## 
## Examples are provided at the bottom of the file for collections 
## of related commands, which can then be delegated out to particular 
## users or groups. 
##  
## This file must be edited with the 'visudo' command.

## Host Aliases 
[root@centosLocal centos]#

basic_centos_linux_commands.html