1BVI(1)                           User Commands                          BVI(1)
2
3
4

NNAAMMEE

6       bvi, bview - visual editor for binary files
7

VVEERRSSIIOONN

9       bvi-1.4.1
10

SSYYNNOOPPSSIISS

12       bbvvii   [--RR] [--cc cmd] [--ff script] [--ss skip] [--ee end] [--nn length] file...
13       bbvviieeww [--RR] [--cc cmd] [--ff script] [--ss skip] [--ee end] [--nn length] file...
14

OOPPTTIIOONNSS

16       file...
17           A  list  of  filenames.  The first one will be the current file and
18           will be read into  the  buffer.  The  cursor  will  be  positioned
19           on the first line of the buffer.  You can get to the other files
20           with the ":next" command.
21
22       --RR  "Readonly": The readonly flag is set for all the files, preventing
23           accidental overwriting with a write command.
24
25
26       --ss skip
27           causes bvi to load a file not from the start but from offset skip.
28           Skip offset bytes from the beginning of the input.  By default,
29           offset is interpreted as a decimal number.  With a leading 0x or
30           0X, offset is interpreted as a hexadecimal number, otherwise, with
31           a leading 0, offset is interpreted as an octal number.  Appending
32           the character b, k, or m to offset causes it to be interpreted as a
33           multiple of 512, 1024, or 1048576, respectively.
34
35
36       --ee end
37           causes bvi to load a file not till end but till address end.
38
39
40       --nn length
41           causes bvi not to load the complete file but only length bytes.
42
43
44       --cc cmd
45           cmd will be  executed  after  the  first file  has been read. If
46           the  cmd  contains spaces  it  must  be enclosed in double quotes
47           (this depends on  the  shell  that  is  used).
48
49       --ff script
50           This command provides a means for collecting a series of "ex"
51           (colon) commands into a script file, then using this file to edit
52           other files. Since there is no binary stream editor "bsed", you can
53           use this option to make several global changes in a binary file.
54

DDEESSCCRRIIPPTTIIOONN

56       Bvi stands for "Binary VIsual editor".  Bvi is a screen oriented editor
57       for binary files; its command set is based on that of the vi(1) text
58       editor.  As bvi is a binary editor, it does not have the concept of
59       "lines".  All end-of-lines (EOLs) are simply bytes.  Therefore bvi's
60       commands are different from vi's commands for all line-oriented
61       commands (see below).
62

CCOOMMPPAARRIISSOONN

64       The main differences between Vi and Bvi are:
65
66       The screen is divided in three sections or panes: The byte offset
67       (extreme left), the hex pane (middle), and an ascii pane (right) which
68       shows as printable characters those bytes in the hex pane.  On an 80
69       column terminal there will be sixteen hex values and their ASCII values
70       on each screen line.  Note that (as one would expect) the first byte
71       has the offset '0' (zero).
72
73       You can toggle between the hex and ascii windows with the tab key
74       (TAB).  Toggling between these two windows does not change the current
75       position (offset) within the file.
76
77       No "lines" concept: Files are treated as one long stream of bytes.  The
78       characters "newline" and "carriage return" are not special, id est they
79       never mark the end of lines.  Therefore the lines on the screen do not
80       represent lines in the usual way.  Data is broken across screen lines
81       arbitarily.  As a consequence there are no commands in bvi from ex or
82       vi that are based on line numbers, eg "dd", "yy", 'C', 'S', 'o', 'O'.
83       This also changes the meaning of "range" before the ":write" command to
84       a byte offset, ie the command ":100,200w foo" writes all *bytes* (not
85       lines) from offset 100 to offset 200 to the file "foo".
86
87       No "text objects": There are also no text-specific arrangements like
88       words, paragraphs, sentences, sections and so on.
89
90       Extended "ruler": The bottom line of the screen shows the current
91       address (byte offset) and the current character in these notations:
92
93               octal, hexadecimal, decimal and ascii.
94
95       Search patterns: All search commands understand these special
96       characters:
97
98            .    any character
99            []   set of characters
100            *    zero or more occurrences of previous char or set
101
102       But as there is no concept of lines you cannot use the standard symbols
103       ("anchors") for "begin-of-line" ('^') and "end-of-line" ('$').
104       Searching for the start/end of lines must be done explicitly by adding
105       these special characters to your search pattern using these meta
106       sequences:
107
108               \n   newline
109               \r   return
110               \t   tab
111               \0   binary zero
112
113       Additional search commands: Similar to the text search commands there
114       are additional hex-search functions '\' and '#' which allow to search
115       for any byte value.  Example:  "\62 76 69" will search for the string
116       "bvi".  Spaces between hex value are optional, so searching for
117       "6775636B6573" will find "guckes".
118
119       Changing the length of data (insertion, deletion) moves the data to
120       other addresses; this is bad for many cases (eg. databases, program
121       files) and is thus disabled by default. You can enable this commands by
122       typing
123
124            :set memmove
125
126       BBVVII MMooddeess::
127
128       Command Mode (Normal Mode):
129
130       Input is treated as command.  Note that command mode is the default
131       mode after startup and after escaping from input mode.  Use ESC
132       (escape) to cancel a partial (uncompleted) command.
133
134       Input Mode:
135
136       Input is treated as replacement of current characters or (after the end
137       of the file) is appended to the current file.  This mode is entered
138       from command mode by typing one of 'i', 'I', 'A', 'r', or 'R'.  You can
139       enter the characters from the keyboard (in the ASCII window) or
140       hexadecimal values (in the HEX window).  Type TAB to switch between
141       these two windows.  Type ESC to finish the current input and return to
142       command mode.  Type CTRL-C to cancel current command abnormally.
143
144       Command line mode (Last Line Mode or : mode):
145
146       Similar to vi, this mode is entered by typing one of the characters : /
147       ? \ # !  The command is terminated and executed by typing a carriage
148       return; to cancel a partially typed command, type ESC to cancel the
149       current command and return to command mode.
150

EENNVVIIRROONNMMEENNTT

152       The editor recognizes the environment variable BVIINIT as  a command
153       (or  list of commands) to run when it starts up. If this variable is
154       undefined, the editor  checks  for  startup commands  in  the  file
155       ~/.bvirc  file, which you must own.  However, if there is a .bvirc
156       owned by you  in  the  current directory,  the  editor takes its
157       startup commands from this file - overriding both the file in your home
158       directory  and the environment variable.
159

TTEERRMMIINNOOLLOOGGYY

161       Characters names are abbreviated as follows:
162            Abbr.     ASCII     name      aka
163            CR        010       carriage return
164            ^A        001       control-a
165            ^H        008       control-h
166            ^I        009       control-i      aka TAB
167            ^U        021       control-u
168            ^Z        026       control-z
169            ESC       027       escape         aka ESC
170            DEL       127       delete
171            LEFT      ---       left  arrow
172            RIGHT     ---       right arrow
173            DOWN      ---       down  arrow
174            UP        ---       up    arrow
175

CCOOMMMMAANNDD SSUUMMMMAARRYY

177       See the TERMINOLOGY for a summary on key name abbreviations used within
178       the following description of commands.
179
180       AAbbssttrraacctt::
181         Arrow keys move the cursor on the screen within the current window.
182
183       SSaammppllee ccoommmmaannddss::
184         :version    show version info
185         <- v ^ ->   arrow keys move the cursor
186         h j k l     same as arrow keys
187         u           undo previous change
188         ZZ          exit bvi, saving changes
189         :q!         quit, discarding changes
190         /text       search for text
191         ^U ^D       scroll up or down
192
193       CCoouunnttss bbeeffoorree bbvvii ccoommmmaannddss::
194         Numbers may be typed as a prefix to some commands.
195         They are interpreted in one of these ways.
196
197         screen column       ⎪
198         byte of file        G
199         scroll amount       ^D  ^U
200         repeat effect       most of the rest
201
202       IInntteerrrruuppttiinngg,, ccaanncceelliinngg
203         ESC         end insert or incomplete command
204         DEL         (delete or rubout) interrupts
205
206       FFiillee mmaanniippuullaattiioonn::
207         ZZ          if file modified, write and exit;
208                     otherwise, exit
209         :w          write changed buffer to file
210         :w!         write changed buffer to file, overriding
211                     read-only ("forced" write)
212         :q          quit when no changes have been made
213         :q!         quit and discard all changes
214         :e file     edit file
215         :e!         re-read current file, discard all changes
216         :e #        edit the alternate file
217         :e! #       edit the alternate file, discard changes
218         :w  file    write current buffer to file
219         :w! file    write current buffer to file overriding
220                     read-only (this "overwrites" the file)
221         :sh         run the command as set with option "shell",
222                     then return
223         :!cmd       run the command cmd from "shell", then
224                     return
225         :n          edit next file in the argument list
226         :f          show current filename, modified flag,
227                     current byte offset, and percentage of
228                     current position within buffer
229         ^G          same as :f
230
231       AAddddiittiioonnaall eeddiitt ccoommmmaannddss
232         You can insert/append/change bytes in ASCII/binary/decimal/
233       hexadecimal or octal representation. You can enter several (screen)
234       lines of input. A line with only a period (.) in it will terminate the
235       command. You must not type in values greater than a byte value. This
236       causes an abandonment of the command.  Pressing the CR key does not
237       insert a newline - character into the file. If you use ASCII mode you
238       can use the special characters \n, \r, \t and \0.
239
240         :i aCR      insert bytes (ASCII) at cursor position
241         :a bCR      append bytes (Binary) at end of file
242         :c hCR      change bytes (hexadecimal) at cursor position
243
244       BBiitt--lleevveell ooppeerraattiioonnss
245         :and n      bitwise 'and' operation with value n
246         :or  n      bitwise 'or' operation with value n
247         :xor n      bitwise 'xor' operation with value n
248         :neg        two's   complement
249         :not        logical negation
250         :sl i       shift  each byte i bits to the left
251         :sr i       shift  each byte i bits to the right
252         :rl i       rotate each byte i bits to the left
253         :rr i       rotate each byte i bits to the right
254
255       CCoommmmaanndd mmooddee aaddddrreesssseess
256         :w foo         write current buffer to a file
257                        named "foo"
258         :5,10w foo     copy byte 5 through 100 into as
259                        file named foo
260         :.,.+20w foo   copy the current byte and the next
261                        20 bytes to foo
262         :^,'aw foo     write all bytes from the beginning
263                        through marker 'a'
264         :/pat/,$ foo   search pattern pat and and copy
265                        through end of file
266
267       PPoossiittiioonniinngg wwiitthhiinn ffiillee::
268         ^B      backward screen
269         ^F      forward  screen
270         ^D      scroll down half screen
271         ^U      scroll up   half screen
272         nG      go to the specified character
273                 (end default), where n is a decimal address
274         /pat    next line matching pat
275         ?pat    previous line matching pat
276         \hex    jump to next     occurrence of hex string hex
277         #hex    jump to previous occurrence of hex string hex
278         n       repeat last search command
279         N       repeat last search command, but in opposite
280                 direction
281
282       AAddjjuussttiinngg tthhee ssccrreeeenn::
283         ^L      clear and redraw screen
284         zCR     redraw screen with current line at top of screen
285         z-      redraw screen with current line at bottom of
286                 screen
287         z.      redraw screen with current line at center of
288                 screen
289         /pat/z- search for pattern pat and then move currents
290                 line to bottom
291         ^E      scroll screen down 1 line
292         ^Y      scroll screen up   1 line
293
294       MMaarrkkiinngg aanndd rreettuurrnniinngg::
295         mx      mark current position with lower-case letter x
296                 Note: this command works for all lower-case letters
297         'x      move cursor to mark x in ASCII section
298         `x      move cursor to mark x in HEX section
299         ''      move cursor to previous context in ASCII section
300         ``      move cursor to previous context in HEX section
301
302       LLiinnee ppoossiittiioonniinngg::
303         H           jump to first      line on screen ("top")
304         L           jump to last       line on screen ("low")
305         M           jump to middle     line on screen ("middle")
306         -           jump onto previous line on screen
307         +           jump onto next     line on screen
308         CR          same as +
309         DOWN or j   next     line, same column
310         UP   or k   previous line, same column
311
312       CChhaarraacctteerr ppoossiittiioonniinngg::
313         ^           first byte in HEX window
314         $           end of screen line
315         l or RIGHT  jump onto next byte (within current
316                     screen line)
317         h or LEFT   jump onto previous byte (within current
318                     screen line)
319         ^H          same as LEFT
320         space       same as RIGHT
321         fx          find next     occurrence of character x
322         Fx          find previous occurrence of character x
323         n⎪          jump onto nth byte/character within current
324                     line
325
326       SSttrriinnggss::
327         (works similar to the strings(1) command)
328         Note:  "Words" are defined as strings of "nonprinting
329         characters".
330         e       jump to next     end   of word
331         w       jump to next     begin of word
332         b       jump to previous begin of word
333         W       forward to next string delimited with a
334                 \0 or \n
335         B       back to previous string delimited with a
336                 nonprinting char
337
338       CCoorrrreeccttiioonnss dduurriinngg iinnsseerrtt::
339         ^H      erase last character (backspace)
340         erase   your erase character, same as ^H (backspace)
341         ESC     ends insertion, back to command mode
342
343       AAppppeenndd aanndd rreeppllaaccee::
344         A       append at end of file
345         rx      replace current bte with char 'x'
346         R       enter replace mode; for all subsequent input,
347                 the current byte is overwritten with the next
348       input character; leave replace mode with ESC.
349
350       MMiisscceellllaanneeoouuss OOppeerraattiioonnss::
351         TAB     toggle between ASCII and HEX section
352
353       YYaannkk aanndd PPuutt::
354         3ySPACE yank 3 characters
355         p       insert contents of yank buffer
356         o       replace text with content of yank buffer
357         P       put back at end of file
358
359       UUnnddoo,, RReeddoo::
360         u       undo last change
361                 Note:  Only the last change can be undone.
362                 Therefore this commands toggles between the
363                 last and second-t-last state of the buffer.
364
365       SSeettttiinngg OOppttiioonnss::
366         With the :set command you can set options in bvi
367
368         Option     Default  Description
369
370         autowrite  noaw     Save current file, if modified, if you
371                             give a :n, :r or ! command
372         columns    cm=16    on an 80 character wide terminal
373         ignorecase noic     Ignores letter case in searching
374         magic      nomagic  Makes . [ * special in patterns
375         memmove    nomm     enables insert and delete commands
376         offset     of=0     adds an offset to the diplayed addresses
377         readonly   noro     If set, write fails unless you use ! after command
378         reverse    nore     display otherwise-printable characters with their
379                             high bit set as reverse video
380         scroll     sc=1/2 window
381                             Number of lines scrolled by ^U and ^D
382         showmode   mo       Displays statusline on bottom of the screen
383         terse      noterse  Let you obtain shorter error messages
384         window     window=screensize
385                             Lines in window, can be reduced at slow terminals
386         wordlength wl=4     Length of an ASCII-string found by w, W, b or B
387         wrapscan   ws       Searches wrap around past the end of the file
388         unixstyle  nous     The representation of ascii characters below
389                             32 is displayed in the statusline as shown
390                             in ascii(7) if unset rather in DOS-style (^A)
391
392

AAUUTTHHOORR

394       bvi was developed by Gerhard Buergmann, Vienna, Austria gerhard@puon.at
395

WWWWWW

397       Bvi Homepage:  http://bvi.sourceforge.net/
398       Vi Pages:      http://www.guckes.net/vi/clones.php3
399                      (all about Vi and its clones)
400

FFIILLEESS

402        $HOME/.bvirc          editor startup file
403        ./.bvirc              editor startup file
404

BBUUGGSS

406       Bvi does not update the screen when the terminal changes its size.
407

SSEEEE AALLSSOO

409       bmore(1), vi(1), strings(1), ascii(5)
410
411
412
413
4143rd Berkeley Distribution      BVI Version 1.4.2                        BVI(1)
Impressum