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

NNAAMMEE

6       bvi, bview - visual editor for binary files
7

VVEERRSSIIOONN

9       bvi-1.4.0
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 a binary editor does not have the concept of "lines" there
59       are differences from Vi commands wherever the latter are line
60       orientate.
61

CCOOMMPPAARRIISSOONN

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

EENNVVIIRROONNMMEENNTT

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

TTEERRMMIINNOOLLOOGGYY

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

CCOOMMMMAANNDD SSUUMMMMAARRYY

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

AAUUTTHHOORR

391       bvi was developed by Gerhard Buergmann, Vienna, Austria
392       Gerhard.Buergmann@puon.at
393

WWWWWW

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

FFIILLEESS

400        $HOME/.bvirc          editor startup file
401        ./.bvirc              editor startup file
402

BBUUGGSS

404       Bvi does not update the screen when the terminal changes its size.
405

SSEEEE AALLSSOO

407       vi(1), strings(1), ascii(5)
408
409
410
411
4123rd Berkeley Distribution      BVI Version 1.4.0                        BVI(1)
Impressum