Thursday 30 July 2015

Navigating in vi editor-AIX



                                             Navigating in VI Editor-AIX




As an Oracle DBA you need to be aware of some operating system chores. You need to know how to move around a file using VI editor.

In command mode, your keyboard becomes an interface tool, as opposed to a text-input tool.The first basic operation to learn is moving the cursor. Most modern versions of vi allow you to use the arrow keys on the keyboard, but vi users prefer the easily accessible keys under their fingertips, h-j-k-l:
·         h and l represent left and right, respectively, which is intuitive because they bound the four navigation keys on the left and on the right.
·         k moves the cursor up.
·         j moves the cursor down.

You can also navigate to the end of each word by using the e key to move forward, or by pressing g. Press e to go backward

Now, you can quickly move within a line but, as you deal with larger files, it's also important to rapidly navigate from line to line. There are a few ways to do this in vi. You can use the up and down commands (k and j), or you can use the page-up and page-down commands. Most commands in vi don't require you to press the Ctrl key, but the page-up and page-down commands are a couple of exceptions to this loose rule:
·         Press Ctrl-u to go up a page.
·         Press Ctrl-d to go down a page.

To quickly navigate to the beginning or end of a file, you can use gg or G:

·         Pressing gg puts the cursor on the first line of the document.
·         Pressing G puts the cursor on the last line of the document.
Press gg, i, and then type new text. Press the Esc key when you're finished to go back to command mode. Remember, you must go back into command mode after entering new text, or there is no way to navigate the document.

No comments:

Post a Comment