Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display file in binary format

Tags:

vim

binary

I'd like to view executable file in Vim.

I used :set binary and thought that I will see only ones and zeros, but nothing changed.

How can I achieve to see only ones and zeros?

like image 278
xralf Avatar asked Jan 21 '12 13:01

xralf


People also ask

How can I view 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.

How do I view bytes of a file?

Right-click the file and click Properties. The image below shows that you can determine the size of the file or files you have highlighted from in the file properties window. In this example, the chrome. jpg file is 18.5 KB (19,032 bytes), and that the size on disk is 20.0 KB (20,480 bytes).

How do I view HEX files?

HEX files are supported by several editors, including Heaventools FlexHex, Hex Workshop Hex Editor, and HexEdit. If you have a binary HEX file, it can only be opened with hex-editing programs. If you have a text-based HEX file, it can also be opened and edited with a text editor.


2 Answers

This did the trick for me:

:%!xxd -b
like image 192
rhegler19 Avatar answered Oct 21 '22 01:10

rhegler19


Instead of ones and zeros, you can get an hexadecimal representation with:

:setlocal display=uhex

Also, you can get an hexadecimal dump of a buffer with:

:%!xxd

Source

like image 40
jcollado Avatar answered Oct 21 '22 02:10

jcollado