How to view files in binary from bash?

adam_0 picture adam_0 · Nov 19, 2009 · Viewed 437.8k times · Source

I would like to view the contents of a file in the current directory, but in binary from the command line. How can I achieve this?

Answer

Emilio Bool picture Emilio Bool · Nov 30, 2013

xxd does both binary and hexadecimal.

bin:

xxd -b file

hex:

xxd file