When the command completes, press Enter and you are back to editing the
TIP
77
Running Commands from the Shell 2
file. You could even use this technique to launch a shell (:!bash) from vi, run a few
commands from that shell, and then type exit to return to vi. (I recommend doing a save
before escaping to the shell, just in case you forget to go back to vi.)
Ctrl+G??”If you forget what you are editing, pressing these keys displays the name of
the file that you are editing and the current line that you are on at the bottom of the
screen. It also displays the total number of lines in the file, the percentage of how far you
are through the file, and the column number the cursor is on. This just helps you get
your bearings after you??™ve stopped for a cup of coffee at 3 a.m.
Moving Around the File
Besides the few movement commands described earlier, there are other ways of moving around
a vi file. To try these out, open a large file that you can??™t do much damage to. (Try copying
/var/log/messages to /tmp and opening it in vi.) Here are some movement commands you
can use:
Ctrl+F??”Page ahead, one page at a time.
Ctrl+B??”Page back, one page at a time.
Ctrl+D??”Page ahead one-half page at a time.
Ctrl+U??”Page back one-half page at a time.
Pages:
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241