天天看點

20、head和od

一、head與od

1、head -n 18 filename.cpp | tail -n 1

head [OPTION]... [FILE]... //output the first part of files

-n, --lines=[-]N

print the first N lines instead of the first 10; with the leading '-', print all but the last N lines of each file。

head -n 3 filename 等價于head -n3 header.h

head --lines=5 header.h

-c //顯示前n位元組

-v //顯示檔案名

-q //不顯示檔案名

2、od

od(octal dump)

od - dump files in octal and other formats

od [OPTION]...[FILE]...

文法:od [-abcdfhilovx][-A <字碼基數>][-j <字元數目>][-N <字元數目>][-s <字元串字元數>][-t <輸出格式>][-w <每列字元數>][--help][--version][檔案...]

補充說明:od指令會讀取所給予的檔案的内容,并将其内容以八進制字碼呈現出來。【1】

od常用的還是傳統的指令格式

-a file //選出指字的字元顯示,忽略高位

-c file //以ASCII characters or backslash escapes顯示字元

-x file //以16進制顯示字元

-f file //以浮點數顯示字元

-d file //十進制

參考

繼續閱讀