每天一個linux命令(14):head命令

來源:互聯網
上載者:User


每天一個linux命令(14):head命令 相關連結:每天一個linux命令(1):ls命令http://www.bkjia.com/os/201210/163049.html;每天一個linux命令(2):cd命令http://www.bkjia.com/os/201210/163050.html;每天一個linux命令(3):pwd命令http://www.bkjia.com/os/201210/163462.html;每天一個linux命令(4):mkdir命令http://www.bkjia.com/os/201210/163463.html;每天一個linux命令(5):rm命令http://www.bkjia.com/os/201210/163662.html;每天一個linux命令(6):rmdir命令http://www.bkjia.com/os/201210/164017.html;每天一個linux命令(7):mv命令http://www.bkjia.com/os/201210/164247.html;每天一個linux命令(8):cp命令http://www.bkjia.com/os/201210/164254.html;每天一個linux命令(9):touch命令http://www.bkjia.com/os/201211/165699.html;每天一個linux命令(10):cat命令http://www.bkjia.com/os/201211/165989.html;每天一個linux命令(11):nl命令http://www.bkjia.com/os/201211/165990.html每天一個linux命令(12):more命令http://www.bkjia.com/os/201211/165994.html每天一個linux命令(13):less命令http://www.bkjia.com/os/201211/165998.html head 與 tail 就像它的名字一樣的淺顯易懂,它是用來顯示開頭或結尾某個數量的文字區塊,head 用來顯示檔案的開頭至標準輸出中,而 tail 想當然爾就是看檔案的結尾。 1.命令格式:  www.2cto.com  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]# 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.