介紹
head
指令用來檢視檔案的前十行。
語法
head [options] [files]
常用的options
-n N Print the first N lines instead of 10.
-N Same as -n N.
-c N Print the first N bytes of the file.
-q Quiet mode: when processing more than one file, don't print a banner above each file. Normally, head prints a banner containing the filename.
範例
你可以檢視檔案的前十行,或預覽檔案:
⤍ head myfile
搭配萬用字元,你可以預覽所有myfile
開頭的檔案:
⤍ head myfile*
⤍ head myfile* | less
搭配ls
指令,你可以查看最近10筆修改的檔名:
⤍ ls -at | head
⤍ ls -alt | head
發佈留言