Chapter 2 . Running Commands from (Web hosting billing) the Shell
Chapter 2 . Running Commands from the Shell 73 . M Moves the cursor to the first character of the middle line on the screen. . L Moves the cursor to the lower-left corner of the screen (last line on the screen). The only other editing you need to know is how to delete text. Here are a few vi commands for deleting text: . x Deletes the character under the cursor. . X Deletes the character directly before the cursor. . dw Deletes from the current character to the end of the current word. . d$ Deletes from the current character to the end of the current line. . d0 Deletes from the previous character to the beginning of the current line. To wrap things up, use the following keystrokes for saving and quitting the file: . ZZ Save the current changes to the file and exit from vi. . :w Save the current file but continue editing. . :wq Same as ZZ. . :q Quit the current file. This works only if you don t have any unsaved changes. . :q! Quit the current file and don t save the changes you just made to the file. If you ve really trashed the file by mistake, the :q! command is the best way to exit and abandon your changes. The file reverts to the most recently changed version. So, if you just did a :w, you are stuck with the changes up to that point. If you just want to undo a few bad edits, press u to back out of changes. You have learned a few vi editing commands. I describe more commands in the following sections. First, however, here are a few tips to smooth out your first trials with vi: . Esc Remember that Esc gets you back to command mode. (I ve watched people press every key on the keyboard trying to get out of a file.) Esc followed by ZZ gets you out of command mode, saves the file, and exits. . u Press U to undo the previous change you made. Continue to press u to undo the change before that, and the one before that. . Ctrl+R If you decide you didn t want to undo the previous command, use Ctrl+R for Redo. Essentially, this command undoes your undo. . Caps Lock Beware of hitting Caps Lock by mistake. Everything you type in vi has a different meaning when the letters are capitalized. You don t get a warning that you are typing capitals things just start acting weird. Tip
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.