精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學習啦 > 學習電腦 > 操作系統(tǒng) > Linux教程 > head命令怎么用

      head命令怎么用

      時間: 春健736 分享

      head命令怎么用

        head 與 tail 就像它的名字一樣的淺顯易懂,它是用來顯示開頭或結尾某個數(shù)量的文字區(qū)塊,head 用來顯示檔案的開頭至標準輸出中,。那么head命令怎么用?下面跟著學習啦小編一起來了解一下吧。

        head命令的用法

        1.命令格式:

        head [參數(shù)]。。. [文件]。。.

        2.命令功能:

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

        3.命令參數(shù):

        -q 隱藏文件名

        -v 顯示文件名

        -c《字節(jié)》 顯示字節(jié)數(shù)

        -n《行數(shù)》 顯示的行數(shù)

        4.使用實例:

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

        命令:

        head -n 5 log2014.log

        輸出:

        [root@localhost test]# cat log2014.log

        2014-01

        2014-02

        2014-03

        2014-04

        2014-05

        2014-06

        2014-07

        2014-08

        2014-09

        2014-10

        2014-11

        2014-12

        ==============================

        [root@localhost test]# head -n 5 log2014.log

        2014-01

        2014-02

        2014-03

        2014-04

        2014-05[root@localhost test]#

        實例2:顯示文件前n個字節(jié)

        命令:

        head -c 20 log2014.log

        輸出:

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

        2014-01

        2014-02

        2014

        [root@localhost test]#

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

        命令:

        head -c -32 log2014.log

        輸出:

        [root@localhost test]# head -c -32 log2014.log

        2014-01

        2014-02

        2014-03

        2014-04

        2014-05

        2014-06

        2014-07

        2014-08

        2014-09

        2014-10

        2014-11

        2014-12[root@localhost test]#

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

        命令:

        head -n -6 log2014.log

        輸出:

        [root@localhost test]# head -n -6 log2014.log

        2014-01

        2014-02

        2014-03

        2014-04

        2014-05

        2014-06

        2014-07[root@localhost test]#

        上面就是Linux下head命令的用法介紹了,head命令只可用于查看前一部分的內容,不能用于查看所有行的內容,你學會了嗎?

      看過“head命令怎么用”的人還看了:

      1.linux tail命令的使用方法

      2.head的用法和短語例句

      3.Linux系統(tǒng)中head命令如何使用

      4.如何在Linux下使用Git

      5.Linux mail命令怎么用

      647704