How to Edit a Hex File in Linux From the Command Line
- 1). Log into the Linux computer in text mode. Linux will start a command shell, which will in turn prompt you to enter a text-mode command.
- 2). Invoke the "vim" text editor in binary mode as follows:
vim -b
Press "Enter." - 3). Configure vim to operate in hex mode, then load the file you need to edit by typing the commands below:
:setlocal wrap display=uhex
:r !xxd myFile.hex
Replace "myFile.hex" by the name of the file you need to edit. Press "Enter" after each line. Vim will display the contents of the file in both hex and text -- at the right end of each line -- modes. - 4). Alter the contents of the file as needed by using the arrow keys to move around.
- 5). Exit vim while saving your modifications, by pressing "Esc" and then typing:
:wq
Press "Enter."
Source...