Search code examples
bashoctalod

Why does od linenumber increment by 2?


Example:

od /bin/bash | head -n4

Gives the output

0000000 042577 043114 000402 000001 000000 000000 000000 000000
0000020 000002 000076 000001 000000 002540 000102 000000 000000
0000040 000100 000000 000000 000000 146600 000017 000000 000000
0000060 000000 000000 000100 000070 000011 000100 000034 000033

My question is, Why doesn't each line number (shown above in bold) increment by 1?
It goes from 0 to 2 to 4 and so forth.

Shouldn't it be 0, 1, 2 ... 7?


Solution

  • The leftmost column is not a line number but rather the byte offset presented in octal form. Each line of default od output has 16 bytes in it. So, the offset goes 0, 16 (octal 20), 32 (octal 40), etc.