shell命令 xxd命令

2021-09-03 01:50:47 字數 1035 閱讀 4148

xxd是二進位制檢視命令,預設將2檔案顯示為16進製制字串表示形式。

看例子:

[root@ambari dir]

# cat t

31[root@ambari dir]

# xxd t

0000000: 3331 0a 31.

[root@ambari dir]

# xxd -ps t

33310a

[root@ambari dir]

# xxd -b t

0000000: 00110011 00110001 00001010 31.

-ps 引數:以 postscript的連續16進製制轉儲輸出,也叫做純16進製制轉儲。

-b引數:以2進製字串形式輸出。

-r引數:逆向轉換。將16進製制字串表示轉為實際的數:

[root@ambari dir]

# echo -n "0000000: 3331 0a 31." | xxd -r

31[root@ambari dir]

# echo -n "0000000: 3331 0a" | xxd -r

31[root@ambari dir]

# echo -n "33310a" | xxd -r -ps

31[root@ambari dir]

# echo -n "33310a" | xxd -r -ps

31

實際上xxd -r -ps是將字串"33310a"轉為了0x33310a這個數,而這個數正好可以被shell顯示為"31"而已。

[root@ambari ~]

# echo -n "aabbcc0a" | xxd -r -ps

ª»[root@ambari ~]

#

xxd命令中文引數說明

xxd命令英文引數說明 usage xxd options infile outfile orxxd r s offset c cols ps infile outfile options a toggle autoskip a single replaces nul lines.default o...

shell 命令 Unix Linu命令 2

這裡是一篇文字 beautifierplugin error unable to handle bash syntax.泰安永佳塑料 xiaoli 泰安永佳塑料 xiaoli 揚州唐城車燈廠,xiaoli 汕頭市魯班裝飾設計工程 方少雄 瀋陽中模技術開發 張弘 瀋陽希望第一小學,王老師 寧波萬力達集...

Shell命令 使用命令

shell命令的基本格式為 command option argumentsoption一般是連字元 加上單個字元,多個這樣的短選項可以寫在一起,如ls lt,很多命令也支援兩個連字元 的長選項,如ls a等價於ls all。多條命令可以寫在一行,使用分號 分隔 預設情況下,傳入給命令的引數會進行單...