adam_0 adam_0 - 7 months ago 27
Linux Question

How to view files in binary in the terminal?

First things first, I'm on a Mac ssh'ing into a Linux machine via Terminal.

I would like to view the contents of a file in the current directory, but in binary. Is there a binary mode for any text editors like VI or Nano or the like?

Answer

xxd does both binary and hexadecimal

bin:

xxd -b file

hex:

xxd file