I checked the od man page, but it does not explain this. What do the numbers on the left column of the od output mean?
- 66,199
- 35
- 114
- 250
- 135
- 6
2 Answers
This is actually mentioned in the info page for od (available by running info od or by visiting https://www.gnu.org/software/coreutils/manual/html_node/od-invocation.html#od-invocation which is also linked to at the end of the man page) file, albeit not in very much depth:
Each line of output consists of the offset in the input, followed by groups of data from the file. By default, od prints the offset in octal, and each group of file data is a C short int’s worth of input printed as a single octal number.
So, in your output, the numbers shown are octal 0000000, 0000020 and 0000030 which are decimal 0, 16 and 24. Note that the n of the word written is the 17th character (byte, here) of the file, therefore it can be found by beginning to read with an offset of 16 and the final newline is the 24th, so the next (empty) line of output starts with an offset of 24.
- 234,489
- 66
- 447
- 667
-
what is the meaning of this line `and each group of file data is a C short int’s worth of input printed as a single octal number.` ? – LocalHost Feb 03 '19 at 15:03
-
@Noshiii My understanding is that `od` displays `X` bytes as an octal number, where `X == sizeof(short int)`. (As the default behavior.) – Samuel Li Dec 29 '19 at 07:55
The first column in the output of od represents the byte offset in file.
- 1,235
- 4
- 18
- 30
-
It does represent the offset, but the *important part* is that it shows the offset in *octal*. – PRouleau May 18 '22 at 03:23
