Binary files are machine readable files that are used to store software packages and utilities. Generally, software developers write programs in human readable languages such as Python, C/C++, Java, etc. and convert their source code into binary files that are directly executable. Sometimes you may need to update the binary file if you don’t have access to original source code that was used to create the binary file. Since binary files consist of only 0 & 1 it is difficult to directly edit them. One of the ways to overcome this problem is to change the hexadecimal representation of your binary file, using a hex editor. In this article we will look at some of the top hex editors in Linux.
Top Hex File Editors in Linux
Hex editors directly open the binary file in hexadecimal format or ASCII format that is easier to edit and save. Here are the top 5 hex editors in Linux. You can easily install them using the following command, depending on your system.
# yum install package [On CentOS] # dnf install package [On Fedora] # apt install package [On Debian/Ubuntu] # zypper install package [On OpenSuse] # pacman -Ss package [on Arch Linux]
1. Xxd Hex Editor
Xxd hex editor is installed in pretty much every Linux Distribution. It is used to modify both hex and binary files. It is capable of producing a hexadecimal dump of binary file or standard input, and converting hexadecimal input to binary file.
2. Hexedit Hex Editor
Hexedit Hex editor is another command line hex editor that shows both hex and ascii versions of your file.
3. Hexyl Hex Editor
Hexyl Hex Editor is another useful tool for viewing binary file in hex format and making changes to it. But it may not be present on your system by default and you may need to install it.
Its output is split into 3 columns:
- Offset column – how many bytes into the file you are
- Hex column – shows hexadecimal view of the file
- Textual representation of a file.
Ghex (GNOME Hex Editor) is another popular hex editor. It provides a graphical interface that allows you to easily edit your binary files in hex as well as ASCII formats. It also supports multilevel undo and redo mechanism. Also, it features find and replace functions and converting between octal, binary, hexadecimal and decimal values.
5. Bless Hex Editor
Bless Hex Editor is another graphical hex editor like Ghex that allows you to edit large files with a multilevel undo/redo mechanism. It allows you to work multiple files at the same time by opening them in different tabs, supports find & replace functionality. It also features customizable data views, and multi-threaded searches and saves.
In this article, we have learnt about some of the most popular hex editors in Linux. You can use any of them depending on your requirement. The key is to remember that the underlying file that you view in these editors is still a binary file. They only display the information in a hexadecimal format. When you make changes to these hex files and save them most of these hex editors save the changes back to the binary file.
How to Setup 2 Factor Authentication for SSH in Linux
How to Delete All Text in File Using Vi Editor
How to Edit Hex Files in Linux
How to Add/Remove Software Repository in Fedora
How to Password Protect Vim File in Linux