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.htm
廣告
© . All rights reserved.