Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view files in binary from bash?

Tags:

bash

shell

binary

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?

like image 471
adam_0 Avatar asked Nov 19 '09 18:11

adam_0


People also ask

How do I view the contents of a binary file?

To open the Binary Editor on an existing file, go to menu File > Open > File, select the file you want to edit, then select the drop arrow next to the Open button, and choose Open With > Binary Editor.


2 Answers

xxd does both binary and hexadecimal.

bin:

xxd -b file 

hex:

xxd file 
like image 134
Emilio Bool Avatar answered Sep 22 '22 02:09

Emilio Bool


hexdump -C yourfile.bin 

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

like image 23
tyranid Avatar answered Sep 21 '22 02:09

tyranid