国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

每天一個linux命令:head 命令

2024-06-28 16:02:14
字體:
來源:轉載
供稿:網友

head 與 tail 就像它的名字一樣的淺顯易懂,它是用來顯示開頭或結尾某個數量的文字區塊,head 用來顯示檔案的開頭至標準輸出中,而 tail 想當然爾就是看檔案的結尾。

1.命令格式:

head [參數]... [文件]...

2.命令功能:

head 用來顯示檔案的開頭至標準輸出中,默認head命令打印其相應文件的開頭10行。

3.命令參數:

-q 隱藏文件名-v 顯示文件名-c<字節> 顯示字節數-n<行數> 顯示的行數

4.使用實例:

實例1:顯示文件的前n行 命令:

head -n 5 log2014.log

輸出:

[root@localhost test]# cat log2014.log 2014-012014-022014-032014-042014-052014-062014-072014-082014-092014-102014-112014-12==============================[root@localhost test]# head -n 5 log2014.log 2014-012014-022014-032014-042014-05[root@localhost test]#

實例2:顯示文件前n個字節 命令:

head -c 20 log2014.log

輸出:

[root@localhost test]# head -c 20 log2014.log2014-012014-022014[root@localhost test]#

實例3:文件的除了最后n個字節以外的內容

命令:

head -c -32 log2014.log

輸出:

[root@localhost test]# head -c -32 log2014.log2014-012014-022014-032014-042014-052014-062014-072014-082014-092014-102014-112014-12[root@localhost test]#

實例4:輸出文件除了最后n行的全部內容 命令:

head -n -6 log2014.log

輸出:

[root@localhost test]# head -n -6 log2014.log2014-012014-022014-032014-042014-052014-062014-07[root@localhost test]#
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 北宁市| 大余县| 乳源| 滦南县| 肇源县| 闵行区| 唐海县| 四平市| 乐昌市| 天津市| 昆山市| 赤水市| 萨嘎县| 云林县| 葵青区| 三都| 玛曲县| 临桂县| 平原县| 安泽县| 屏东市| 宁远县| 永丰县| 西昌市| 静乐县| 根河市| 遂溪县| 莎车县| 乐清市| 汕尾市| 资溪县| 云梦县| 夏邑县| 斗六市| 太谷县| 大化| 西乌珠穆沁旗| 泽普县| 浮山县| 鱼台县| 拜泉县|