1HEXEDIT(1) General Commands Manual HEXEDIT(1)
2
3
4
6 hexedit - view and edit files in hexadecimal or in ASCII
7
9 hexedit [-s | --sector] [-m | --maximize] [-l<n> | --linelength <n>]
10 [-h | --help] [filename]
11
13 hexedit shows a file both in ASCII and in hexadecimal. The file can be
14 a device as the file is read a piece at a time. You can modify the file
15 and search through it.
16
18 -s, --sector
19 Format the display to have entire sectors.
20
21 -m, --maximize
22 Try to maximize the display.
23
24 --color
25 Display colors. This feature is only available if your operat‐
26 ing system supports it.
27
28 -l<n>, --linelength <n>
29 Explicitly set the number of bytes to display per line to <n>.
30
31 -h, --help
32 Show the usage.
33
35 Moving
36 <, > : go to start/end of the file
37 Right: next character
38 Left: previous character
39 Down: next line
40 Up: previous line
41 Home: beginning of line
42 End: end of line
43 PUp: page forward
44 PDown: page backward
45
46 Miscellaneous
47 F2: save
48 F3: load file
49 F1: help
50 Ctrl-L: redraw
51 Ctrl-Z: suspend
52 Ctrl-X: save and exit
53 Ctrl-C: exit without saving
54
55 Tab: toggle hex/ascii
56 Return: go to
57 Backspace: undo previous character
58 Ctrl-U: undo all
59 Ctrl-S: search forward
60 Ctrl-R: search backward
61
62 Cut&Paste
63 Ctrl-Space: set mark
64 Esc-W: copy
65 Ctrl-Y: paste
66 Esc-Y: paste into a file
67 Esc-I: fill
68
70 o Right-Arrow, Left-Arrow, Down-Arrow, Up-Arrow - move the cursor.
71 o Ctrl+F, Ctrl+B, Ctrl+N, Ctrl+P - move the cursor.
72 o Ctrl+Right-Arrow, Ctrl+Left-Arrow, Ctrl+Down-Arrow, Ctrl+Up-Arrow -
73 move n times the cursor.
74 o Esc+Right-Arrow, Esc+Left-Arrow, Esc+Down-Arrow, Esc+Up-Arrow - move
75 n times the cursor.
76 o Esc+F, Esc+B, Esc+N, Esc+P - move n times the cursor.
77 o Home, Ctrl+A - go the beginning of the line.
78 o End, Ctrl+E - go to the end of the line.
79 o Page up, Esc+V, F5 - go up in the file by one page.
80 o Page down, Ctrl+V, F6 - go down in the file by one page.
81 o <, Esc+<, Esc+Home - go to the beginning of the file.
82 o >, Esc+>, Esc+End - go to the end of the file (for regular files that
83 have a size).
84 o Ctrl+Z - suspend hexedit.
85 o Ctrl+U, Ctrl+_, Ctrl+/ - undo all (forget the modifications).
86 o Ctrl+Q - read next input character and insert it (this is useful for
87 inserting control characters and bound keys).
88 o Tab, Ctrl+T - toggle between ASCII and hexadecimal.
89 o /, Ctrl+S - search forward (in ASCII or in hexadecimal, use TAB to
90 change).
91 o Ctrl+R - search backward.
92 o Ctrl+G, F4 - go to a position in the file.
93 o Return - go to a sector in the file if --sector is used, otherwise go
94 to a position in the file.
95 o Esc+L - display the page starting at the current cursor position.
96 o F2, Ctrl+W - save the modifications.
97 o F1, Esc+H - help (show the man page).
98 o Ctrl+O, F3 - open another file
99 o Ctrl+L - redisplay (refresh) the display (useful when your terminal
100 screws up).
101 o Backspace, Ctrl+H - undo the modifications made on the previous byte.
102 o Esc+Ctrl+H - undo the modifications made on the previous bytes.
103 o Ctrl+Space, F9 - set mark where cursor is.
104 o Esc+W, Delete, F7 - copy selected region.
105 o Ctrl+Y, Insert, F8 - paste (yank) previously copied region.
106 o Esc+Y, F11 - save previously copied region to a file.
107 o Esc+I, F12 - fill the selection with a string
108 o Esc+T - truncate the file at the current location
109 o Ctrl+C - unconditional quit (without saving).
110 o F10, Ctrl+X - quit.
111
112 For the Esc commands, it sometimes works to use Alt instead of Esc.
113 Funny things here (especially for froggies :) egrave = Alt+H , ccedilla
114 = Alt+G, Alt+Y = ugrave.
115
116 Modeline
117 At the bottom of the display you have the modeline (copied from emacs).
118 As in emacs, you have the indications --, ** and %% meaning unmodified,
119 modified and read-only. Then you have the name of the file you're cur‐
120 rently editing. Next to it is the current position of the cursor in the
121 file followed by the total file size. The total file size isn't quite
122 correct for devices.
123 While in --sector mode, it shows the sector the cursor is in.
124
125 Editing
126 You can edit in ASCII or in hexadecimal. You can switch between the two
127 with Tab. When the file is read-only, you can't edit it. When trying to
128 edit a read-only file, a message "File is read-only" tells you it is
129 non-writable.
130 The modifications are shown in bold until they are saved. The modeline
131 indicates whether you have modified the file or not.
132 When editing in hexadecimal, only 0,1,...,9, a,b,...,f, A,B,...F are
133 legal. Other keys are unbound. The first time you hit an unbound key,
134 the help pops up. It won't pop again unless you call the help directly
135 (with F1).
136 When editing in ascii, you can find it difficult to enter characters
137 like / which are bound to a function. The solution is to use the quoted
138 insert function Ctrl+Q, the key after the quoted insert function is not
139 processed by hexedit (like emacs' quoted-insert, or like the \ charac‐
140 ter in C).
141
142 Searching
143 You can search for a string in ASCII or in hexadecimal. You can switch
144 between the two with Tab. If the string is found, the cursor is moved
145 to the beginning of the matching location. If the search failed, a mes‐
146 sage "not found" tells you so. You can cancel the search by pressing a
147 key.
148 The search in hexadecimal is a bit confusing. You must give a hexadeci‐
149 mal string with an even number of characters. The search can then be
150 done byte by byte. If you want to search a long number (eg: a 32 bit
151 number), you must know the internal representation of that number (lit‐
152 tle/big endian problem) and give it the way it is in memory. For exam‐
153 ple, on an Intel processor (little endian), you must swap every bytes:
154 0x12345678 is written 0x78563412 in memory and that's the string you
155 must give to the search engine.
156 Before searching you are asked if you want to save the changes, if the
157 file is edited.
158
159 For more sophisticated search, see Volker Schatz's patch at
160 <http://www.volkerschatz.com/unix/homebrew.html#hexedit>.
161
162 Selecting, copying, pasting, filling
163 First, select the part of the buffer you want to copy: start setting
164 the mark where you want. Then go to the end of the area you want to
165 copy (you can use the go to function and the search functions). Then
166 copy it. You can then paste the copied area in the current file or in
167 another file.
168
169 You can also fill the selected area with a string or a character: start
170 choosing the block you want to fill in (set mark then move to the end
171 of the block), and call the fill function (F12). hexedit ask you the
172 string you want to fill the block with.
173 The code is not tuned for huge filling as it keeps the modifications in
174 memory until you save them. That's why hexedit will warn you if you try
175 to fill in a big block.
176
177 When the mark is set, the selection is shown in reverse mode.
178 Be aware that the copied area contains the modifications done at the
179 time of the copy. But if you undo the modifications, it does not change
180 the content of the copy buffer. It seems obvious but it's worth saying.
181
182 Scrolling
183 The scrolling is different whether you are in --sector mode or not. In
184 normal mode, the scrolling is line by line. In sector mode, the
185 scrolling is sector by sector. In both modes, you can force the display
186 to start at a given position using Esc+L.
187
189 od(1), hdump(1), hexdump(1), bpe(1), hexed(1), beav(1).
190
192 Pixel (Pascal Rigaux) <pixel@rigaux.org>,
193 Home page is <http://rigaux.org/>.
194
196 hexedit is Open Source; anyone may redistribute copies of hexedit to
197 anyone under the terms stated in the GNU General Public License.
198
199 You can find hexedit at
200 <https://github.com/pixel/hexedit/archive/1.6.tar.gz>
201
203 Anything you think could be nice...
204
206 There are problems with the curses library given with Redhat 5.0 that
207 make hexedit think the terminal is huge. The result is that hexedit is
208 not usable.
209
210 The shortcuts work on some machines, and not on others. That's why
211 there are many shortcuts for each function. The Ctrl+Arrows and the
212 Alt+. do not work work as they should most of the time. On SUNs, you
213 must do Ctrl+V-Ctrl+V instead of Ctrl+V (!); and the Alt key is the di‐
214 amond one.
215
216 While searching, it could be interesting to know which position the
217 search has reached. It's always nice to see something moving to help
218 waiting.
219
220 The hexadecimal search could be able to search modulo 4 bits instead of
221 8 bits. Another feature could be to complete padd odd length hexadeci‐
222 mal searches with zeros.
223
225 I have an example where the display is completely screwed up. It seems
226 to be a bug in ncurses (or maybe in xterm and rxvt)?? Don't know if
227 it's me using ncurses badly or not... It seems to happen when hexedit
228 leaves only one space at the end of the lines... If anyone has a (or
229 the) solution, please tell me!
230
231 If you have any problem with the program (even a small one), please do
232 report it to me. Remarks of any kind are also welcome.
233
234 12 July 1998 HEXEDIT(1)