It is best to remember the functions of the hjkl keys as they are common to all terminals, whereas the arrow keys may not always be supported. If you preface any of the commands given above with a number n, then that command will be repeated n times. Deletions and alterations are best performed from the command mode. While you can use the backspace key to remove characters on the current line between the point of insertion and the current cursor position, you cannot use it to remove characters outside of that block of text. To exit from vi , you must be in the command mode.
Printing is managed by the lp or l ine p rinter command.
Searching files using regular expressions There are three basic UNIX commands that deal, in some form or another with text processing. Sed builds upon the functionality of grep adding primative conditionals and switch statements, and awk builds upon sed to add variables, subroutines, loops and other expressions. Both sed and awk can manipulate the text as well as display it, while grep is limited to display only. For the purposes of this tutorial, only grep will be discussed. This searches the named files and prints each line that contains at least one instance of the pattern.