How to edit binary file on Unix systems
Solution 1
You can also try ghex2 GNOME utilities. This give you the automated hex-to-ASCII on the side, as well as the various character/integer decodes at the bottom.
(source: googlepages.com)
Solution 2
In vim You can type :%!xxd to turn it into a hexeditor. :%!xxd -r to go back to normal mode. xxd is shipped in a vim installation.
See here for some remarks about editing binary files with vim (boils down to :set binary to avoid trouble, use only the "R" or "r" command to change text, don't delete characters).
If You are an Emacs fan, see here for a guide on how to edit a binary file with Emacs.
Solution 3
There are much more hexeditors on Linux/Unix....
I use hexedit on Ubuntu
sudo apt-get install hexedit
Solution 4
you can check wikipedia.
I prefer BIEW especially.
Solution 5
Bless is a high quality, full featured hex editor.
It is written in mono/Gtk# and its primary platform is GNU/Linux. However it should be able to run without problems on every platform that mono and Gtk# run. Main Features Bless currently provides the following features:
- Efficient editing of large data files and block devices.
- Multilevel undo - redo operations.
- Customizable data views.
- Fast data rendering on screen.
- Multiple tabs.
- Fast find and replace operations.
- A data conversion table.
- Advanced copy/paste capabilities.
- Highlighting of selection pattern matches in the file.
- Plugin based architecture.
- Export of data to text and html (others with plugins).
- Bitwise operations on data.
- A comprehensive user manual.
Hemant
Updated on July 05, 2022Comments
-
Hemant almost 2 years
On Windows machines there are lots of third party editors available to edit a binary file.
Any idea how can I edit a binary file on Unix system?
-
Shannon Nelson almost 15 yearsYes, this works, but it is more difficult to use because you need to work at keeping the xxd text formatted properly, and the ASCII decode on the side isn't automatic.
-
Paweł Polewicz almost 15 yearsMore difficult than what? I'd like to remind that the question was about hexeditors shipped with *nix. Console users don't have much choice.
-
Hemant almost 15 yearsThanks. it present on my sunos system. any thing on hpux ?
-
Shannon Nelson almost 15 yearsI don't know what all is on HPux, but since it is open source software you could probably find the source, compile and install it yourself.
-
Adam Trhon about 13 yearsI removed the offensive statement (try to avoid these) and added info about used GUI toolkit (found on your website). Hope it's OK.
-
HRJ over 12 yearsThanks for the wikipedia link. I liked Hexditor.jar
-
raj_gt1 over 11 yearsI would have loved it if copy-paste would have working. I am using ghex v2.5 and it only paste one byte at a time. is there a way to bulk copy paste ??
-
Ciro Santilli OurBigBook.com about 9 years@ShannonNelson I agree. Also have a look at bvi,
sudo apt-get install bvi
, which is ncurses and uses vim-like shortcuts. -
Ciro Santilli OurBigBook.com about 9 yearsIn particular, you can't add or remove bytes from the middle easily: stackoverflow.com/questions/27086771/…
-
Viktor Vix Jančík almost 9 yearsHexinator is pretty good, but I like 010Editor best though
-
rr- over 8 yearsI see this trick recommended all over the place and it makes me sad. You can't search for anything that happens to span two or more visual lines, you can't easily go to specific offset, the editing is inferior (can't input floats for example), can't delete or insert new bytes without screwing everything up... what can you do besides flipping bytes?
-
yugr about 7 years@rr It's more than enough when you found offending snippet in objdump's output and need to simply nop it out in executable. I'd +100 this if I could.
-
Michael Martinez about 5 yearsExcellent solution.
vim -b
. I used it to change the soname on some shared library dependencies in an executable and worked perfectly. -
Shai Alon over 3 yearsMoved to here: github.com/afrantzis/bless
-
Peter Mortensen almost 2 yearsThe link is broken: "Page not found"
-
Peter Mortensen almost 2 yearsWhat is the reason for "via the menu"? What happens if you don't?