hexedit shows a file both in ASCII and in hexadecimal. The file can be a device as the file is read a piece at a time. You can modify the file and search through it.
"-s, --sector" Format the display to have entire sectors.
"-m, --maximize" Try to maximize the display.
"-h, --help" Show the usage.
: go to start/end of the file
Right: next character
Left: previous character
Down: next line
Up: previous line
Home: beginning of line
End: end of line
PUp: page forward
PDown: page backward
F3: load file
Ctrl-X: save and exit
Ctrl-C: exit without saving
Tab: toggle hex/ascii
Return: go to
Backspace: undo previous character
Ctrl-U: undo all
Ctrl-S: search forward
Ctrl-R: search backward
Ctrl-Space: set mark
Esc-Y: paste into a file
COMMANDS (full and detailed)
· Right-Arrow, Left-Arrow, Down-Arrow, Up-Arrow - move the cursor.
· Ctrl+F, Ctrl+B, Ctrl+N, Ctrl+P - move the cursor.
· Ctrl+Right-Arrow, Ctrl+Left-Arrow, Ctrl+Down-Arrow, Ctrl+Up-Arrow - move n times the cursor.
· Esc+Right-Arrow, Esc+Left-Arrow, Esc+Down-Arrow, Esc+Up-Arrow - move n times the cursor.
· Esc+F, Esc+B, Esc+N, Esc+P - move n times the cursor.
· Home, Ctrl+A - go the beginning of the line.
· End, Ctrl+E - go to the end of the line.
· Page up, Esc+V, F5 - go up in the file by one page.
· Page down, Ctrl+V, F6 - go down in the file by one page.
· , Esc+End - go to the end of the file (for regular files that have a size).
· Ctrl+Z - suspend hexedit.
· Ctrl+U, Ctrl+_, Ctrl+/ - undo all (forget the modifications).
· Ctrl+Q - read next input character and insert it (this is useful for inserting control characters and bound keys).
· Tab, Ctrl+T - toggle between ASCII and hexadecimal.
· /, Ctrl+S - search forward (in ASCII or in hexadecimal, use TAB to change).
· Ctrl+R - search backward.
· Ctrl+G, F4 - go to a position in the file.
· Return - go to a sector in the file if --sector is used, otherwise go to a position in the file.
· Esc+L - display the page starting at the current cursor position.
· F2, Ctrl+W - save the modifications.
· F1, Esc+H - help (show the man page).
· Ctrl+O, F3 - open another file
· Ctrl+L - redisplay (refresh) the display (usefull when your terminal screws up).
· Backspace, Ctrl+H - undo the modifications made on the previous byte.
· Esc+Ctrl+H - undo the modifications made on the previous bytes.
· Ctrl+Space, F9 - set mark where cursor is.
· Esc+W, Delete, F7 - copy selected region.
· Ctrl+Y, Insert, F8 - paste (yank) previously copied region.
· Esc+Y, F11 - save previously copied region to a file.
· Esc+I, F12 - fill the selection with a string
· Esc+T - truncate the file at the current location
· Ctrl+C - unconditional quit (without saving).
· F10, Ctrl+X - quit.
For the Esc commands, it sometimes works to use Alt instead of Esc. Funny things here (especially for froggies :) egrave = Alt+H , ccedilla = Alt+G, Alt+Y = ugrave.
At the bottom of the display you have the modeline (copied from emacs). As in emacs, you have the indications --, ** and %% meaning unmodified, modified and read-only. Then you have the name of the file you're currently editing. Next to it is the current position of the cursor in the file followed by the total file size. The total file size isn't quite correct for devices.
While in --sector mode, it shows the sector the cursor is in.
You can edit in ASCII or in hexadecimal. You can switch between the two with Tab. When the file is read-only, you can't edit it. When trying to edit a read-only file, a message (``File is read-only'') tells you it is non-writable.
The modifications are shown in bold until they are saved. The modeline indicates whether you have modified the file or not.
When editing in hexadecimal, only 0,1,...,9, a,b,...,f, A,B,...F are legal. Other keys are unbound. The first time you hit an unbound key, the help pops up. It won't pop again unless you call the help directly (with F1).
When editing in ascii, you can find it difficult to enter characters like / which are bound to a function. The solution is to use the quoted insert function Ctrl+Q, the key after the quoted insert function is not processed by hexedit (like emacs' quoted-insert, or like the character in C).
You can search for a string in ASCII or in hexadecimal. You can switch between the two with Tab. If the string is found, the cursor is moved to the beginning of the matching location. If the search failed, a message (``not found'') tells you so. You can cancel the search by pressing a key.
The search in hexadecimal is a bit confusing. You must give a hexadecimal string with an even number of characters. The search can then be done byte by byte. If you want to search a long number (eg: a 32 bit number), you must know the internal representation of that number (little/big endian problem) and give it the way it is in memory. For example, on an Intel processor (little endian), you must swap every bytes: 0x12345678 is written 0x78563412 in memory and that's the string you must give to the search engine.
Before searching you are asked if you want to save the changes, if the file is edited.
· There are problems with the curses library given with Redhat 5.0 that make hexedit think the terminal is huge. The result is that hexedit is not usable.
· The shortcuts work on some machines, and not on others. That's why there are many shortcuts for each function. The Ctrl+Arrows and the Alt+. do not work work as they should most of the time. On SUNs, you must do Ctrl+V-Ctrl+V instead of Ctrl+V (!); and the Alt key is the diamond one.
· While searching, it could be interesting to know which position the search has reached. It's always nice to see something moving to help waiting.
· The hexadecimal search could be able to search modulo 4 bits instead of 8 bits. Another feature could be to complete padd odd length hexadecimal searches with zeros.