国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

    linux的head命令

    時(shí)間: 佳洲1085 分享

      head命令用來(lái)顯示開(kāi)頭或結(jié)尾某個(gè)數(shù)量的文字區(qū)塊,下面由學(xué)習(xí)啦小編為大家整理了linux的head命令的相關(guān)知識(shí),希望大家喜歡!

      linux的head命令詳解

      1.命令格式:

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

      2.命令功能:

      head 用來(lái)顯示檔案的開(kāi)頭至標(biāo)準(zhǔn)輸出中,默認(rèn)head命令打印其相應(yīng)文件的開(kāi)頭10行。

      3.命令參數(shù):

      -q 隱藏文件名

      -v 顯示文件名

      -c<字節(jié)> 顯示字節(jié)數(shù)

      -n<行數(shù)> 顯示的行數(shù)

      linux的head命令使用實(shí)例

      實(shí)例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]#

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

      命令:

      head -c 20 log2014.log

      輸出:

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

      2014-01

      2014-02

      2014

      [root@localhost test]#

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

      命令:

      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]#

      實(shí)例4:輸出文件除了最后n行的全部?jī)?nèi)容

      命令:

      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]#

    3623131