![]() You can page or scroll backward or forward through a file, a screen or a half-screen at a time. This scrolling can be an effective way to display more text in a short file, but it can be tedious to move this way through a long file. If you move down when the cursor is at the bottom of the screen, or move up when the cursor is at the top of the screen, you will see the text scroll up or down. Press L (“low”) to move the cursor to the bottom of the screen. Press M (“middle”) to move the cursor to the middle of the screen. Press H (“high”) to move the cursor to the top of the screen. Press the Space Bar to move the cursor one character to the right. Press the Back Space key to move the cursor one character to the left. ![]() Press the Return key to move the cursor to the beginning of the next line down. Press $ to move the cursor to the end of the current line. Press ^ to move the cursor to the start of the current line. Press e (“end”) to move the cursor to the last character of the current word. Press W or B to move the cursor past the adjacent punctuation to the next or previous blank space. Press b (“back”) to move the cursor to the left one word at a time. Press w (“word”) to move the cursor to the right one word at a time. If the arrow keys don't work for you, you can use the following substitutes: The arrow key behavior depends on your terminal emulator. If you're using vi from a remote terminal, the arrow keys might not work correctly. Notice that you can only move the cursor across already existing text or input spaces. You should be able to move the cursor freely about the screen by using combinations of the up, down, right, and left arrow keys. If your machine is equipped with arrow keys, try these now. The same command typed in lowercase and uppercase characters might have different effects. Certain letter keys, the arrow keys, and the Return key, Back Space (or Delete) key, and the Space Bar can all be used to move the cursor when you're in command mode. In command mode, you can move the cursor with a number of keyboard commands. When you start vi, the cursor is in the upper left corner of the vi screen. Open your practice file now, and try each of the commands that are discussed in this section. Now that you have created a file, you'll need to understand the concepts that are required to navigate within it. In the previous sections you learned how to create, save, print, and exit a vi file. :r name = read file ‘name’ – insert it at this position.The following sections explain the following categories of vi commands. ![]() :w name = save the contents to a file named ‘name’. Will not work if any changes have been made :w = write the file to the current file name (see also ^G, below) ZZ = write the data to the current file and then exit vi (Ex: 3dd deletes the current line and the two lines after.) #dd = delete # lines putting the lines into a save buffer ^H = erase last character (usually same as backspace)ĭSPACE = delete the character beneath the cursor (SPACE = space bar)ĭ$ = delete from cursor through end of current line X = delete the character under the cursor Rx = replace character under cursor with character xĬw = change current word Ex: cwnew = change current word to new O = open a new line above the current line O = open a new line below the current line I = insert before (new text will appear before the current cursor position) - leaves you in insert modeĪ = append (new text appears after current cursor position) –leaves you in insert mode :1,$s/pattern/newpattern/g = replace all occurrences of pattern with new pattern. ?pat = move cursor to previous occurrence of pattern pat backward search) pat = move cursor to next occurrence of pattern ‘pat’ (forward search) Ex: Use 0G to move to the top of the file.) L = move the cursor right (on some keyboards, the arrow keys have the same effect) Mv – move a file (also used to rename files): You can also paste by pressing the Shift+Ins (or Shift+Insert on some keyboards) keys together.Ĭd – change directory (navigate to some directory): To paste the contents of the clipboard into the PuTTY window, simply right-click the mouse button. There is no need to press any keys or right-click on a selected area. Use the left mouse button to select text in the PuTTY window, and this automatically copies the selected text to the clipboard.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |