Linux 教程
head 命令可用于查看文件的開頭部分的內(nèi)容,有一個常用的參數(shù) -n 用于顯示行數(shù),默認(rèn)為 10,即顯示 10 行的內(nèi)容。
命令格式:
head [參數(shù)] [文件]
參數(shù):
實例
要顯示 json_notes.log 文件的開頭 10 行,請輸入以下命令:
head json_notes.log
顯示 notes.log 文件的開頭 5 行,請輸入以下命令:
head -n 5 json_notes.log
顯示文件前 20 個字節(jié):
head -c 20 json_notes.log其他擴(kuò)展