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

Source

Solution 2

This did the trick for me:

:%!xxd -b
Share:
37,552
xralf
Author by

xralf

Updated on April 04, 2020

Comments

  • xralf
    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
    xralf over 12 years
    This is useful but it won't display raw file (ones and zeros) as is stored on the harddrive. It's reformated with vim.
  • xralf
    xralf over 12 years
    But 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
    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
    Eugenio F. Martinez Pacheco over 9 years
    Hexadecimal 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
    Iulian Onofrei almost 6 years
    Instead of your answer, you could have given one for ones and zeros, because that's what had been asked for.
  • m4110c
    m4110c over 4 years
    This is not an answer for the question
  • Mustapha-Belkacim
    Mustapha-Belkacim over 4 years
    The first command didn't work for me, but the second one did.