Octal Dump (od ), lets you see ASCII character values as well had hidden ones (an ASCII dump).  It’s pretty rare that you would ever need to do this, but it is very useful when you do, even though it sounds like something that should be relegated to a private restroom.  Throw in a few tarballs and you’re all set for some adolescent humor.

How To Use It

The simplest example is below using a simple echo  command to print the word hello.  If you pipe that command into od using the -cb option, you will get some output like this:

0000000    h   e   l   l   o  \n                                        
          150 145 154 154 157 012                                        

Each character of the word hello has a number below it–this is the octal ASCII value.  For example, “h” has a ASCII value of 150, “e” is 145, and so on.  Notice how there is an extra character at the end of the line, which is kind of invisible as it is a control character, which tells the computer to move to the next line (newline).  This has a code of 012 and is not visible until you pipe it through octal dump.

To illustrate this, run the same command, but instead of just hello, put a space after hello and put it in quotes.  So your command would look like this:

echo "hello "  | od -cb

and the output would be:

0000000    h   e   l   l   o      \n                                    
          150 145 154 154 157 040 012                                    

Notice that the space has a code of 040, which can be seen used in fstab.

Now that you know you can see hidden characters, you can use this to debug two text files that are visually the same, but sometimes one will have a different line-ending.  This proved useful when trying to create a PJL file.  So instead of using \n  (newline code 012), \r  (a carriage return, code 015) might be used.