linux od命令: 按不同進位顯示檔案

來源:互聯網
上載者:User

標籤:

介紹:
od(octal dump)命令可以以八進位、十進位、十六進位和ASCII碼來顯示檔案或者流,它們對於訪問或可視地檢查檔案中不能直接顯示在終端上的字元很有用。
文法:

od [-A 地址進位] [-t 顯示格式] 檔案

選項介紹:
    -A 地址進位: 按指定的進位顯示地址資訊;
    -t 顯示格式: 指定資料的顯示格式;

-A指定地址進位包括:
    o 八進位(系統預設值)
    d 十進位
    x 十六進位
    n 不列印位移值

-t指定資料的顯示格式,主要參數有:
    c ASCII字元或反斜線序列(如\n)
    d 有符號十進位數
    f 浮點數
    o 八進位(系統預設值)
    u 無符號十進位數
    x 十六進位數

執行範例:

 

#od -A x -t x filename   (地址為16進位,資料為16進位)
 

 

01 $ cat text 

02 hello world 

03 od command

04 $ od -A o text #地址顯示為八進位,第一列為地址 

05 0000000 062550 066154 020157 067567 066162 005144 062157 061440 

06 0000020 066557 060555 062156 000012 

07 0000027 

08 $ od -A d text #地址顯示為十進位 

09 0000000 062550 066154 020157 067567 066162 005144 062157 061440 

10 0000016 066557 060555 062156 000012 

11 0000023 

12 $ od -A x text #地址顯示為十六進位 

13 000000 062550 066154 020157 067567 066162 005144 062157 061440 

14 000010 066557 060555 062156 000012 

15 000017 

16 $ od -t c text 

17 0000000   h   e   l   l   o       w   o   r   l   d  \n   o   d       c 

18 0000020   o   m   m   a   n   d  \n 

19 0000027

linux od命令: 按不同進位顯示檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.