Display file in binary format
37,552
Solution 1
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
Solution 2
This did the trick for me:
:%!xxd -b
Author by
xralf
Updated on April 04, 2020Comments
-
xralf about 4 years
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?
-
xralf over 12 yearsThis is useful but it won't display raw file (ones and zeros) as is stored on the harddrive. It's reformated with vim.
-
xralf over 12 yearsBut they write it's not possible in
vim
. Maybe hex is more convenient for real work but it's strange that vim can't display raw file. -
darjab over 12 years@xralf - The thing is, 1's and 0's "format" is not that really useful at all ... so there's not that much demand for it.
-
Eugenio F. Martinez Pacheco over 9 yearsHexadecimal and Binary conversion is straighforward. Hex mode is just that, hex digits. Studying binary data or raw data is a very specific matter, just for hacking, auditing, photography, cibersecurity... few tools can do that...
-
Iulian Onofrei almost 6 yearsInstead of your answer, you could have given one for ones and zeros, because that's what had been asked for.
-
m4110c over 4 yearsThis is not an answer for the question
-
Mustapha-Belkacim over 4 yearsThe first command didn't work for me, but the second one did.