How To Hex Editor In Linux

Hex editors are important tools for systems administrators, programmers, and forensic analysts. In this blog post, we will explain how to use a hex editor on a Linux system. We will be focusing on a popular hex editor called ‘hexedit’.

1. Installation

The first step is installation. Most Linux distributions don’t come with a hex editor pre-installed, so we will need to install one. In this post, we are using ‘hexedit’, a simple to use hex editor. You can install it using the following command:

sudo apt-get install hexedit

If you are using a distribution that uses ‘yum’ instead of ‘apt-get’, you can use the following command:

sudo yum install hexedit

2. Basic Usage

After successful installation, you can start using ‘hexedit’. To open a file, simply type ‘hexedit’ followed by the file name:

hexedit filename

3. Navigating the Hex Editor

In the hex editor, you can navigate using the arrow keys. You will see two sections: the hex section (on the left) and the ASCII section (on the right). Navigating the file will move the cursor on both sections.

4. Editing the File

To switch to edit mode, press the Tab key. The cursor will become underscored, indicating that you can now edit the file. Type your desired hex values and press Ctrl + x to save the changes. Always remember to save your changes before quitting the editor, otherwise your changes will be lost.

5. Switching Between Hex and ASCII Mode

You can switch between hex and ASCII mode by pressing the Tab key. This is useful when you want to edit the ASCII values of a file directly.

6. Searching in the File

You can search for a particular string in the file using the Ctrl + s command. After pressing these keys, you will be prompted to enter the string you want to search for. Press Enter to start the search.

7. Quitting the Editor

Once you are done editing, you can quit the hex editor by pressing Ctrl + q.

8. Conclusion

That’s it! Now you know how to use a hex editor in Linux. Although the process might seem complex at first, with practice, it will become second nature. Happy editing!