How to view files in binary from bash?


Question

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?

1
248
12/5/2018 10:36:51 PM

Accepted Answer

xxd does both binary and hexadecimal

bin:

xxd -b file

hex:

xxd file
419
11/30/2013 9:20:58 PM

hexdump -C yourfile.bin

unless you want to edit it of course. Most linux distros have hexdump by default (but obviously not all).


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon