odとbyte order
odでint/shortで表示すると、CPU nativeのbyte orderで表示してくれることに気がついた。以下はMacBook(Intel)での結果。
1byteずつ表示した場合
> od -t x1 -A x /usr/bin/file | head -n 4 0000000 ca fe ba be 00 00 00 02 00 00 00 07 00 00 00 03 0000010 00 00 10 00 00 00 eb b8 00 00 00 0c 00 00 00 12 0000020 00 00 00 00 00 01 00 00 00 00 dd 38 00 00 00 0c 0000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
4byteずつ表示した場合
> od -t x4 -A x /usr/bin/file | head -n 4 0000000 bebafeca 02000000 07000000 03000000 0000010 00100000 b8eb0000 0c000000 12000000 0000020 00000000 00000100 38dd0000 0c000000 0000030 00000000 00000000 00000000 00000000
4byteずつ表示した場合は、Universal Binaryのマジックナンバーがlittle endianで表示されてる。