Moving Around a File in vi
Usually, you can use the arrow keys on your keyboard to move around the open file in vi. In some cases, such as a very old or very minimal Linux installation, the arrow keys don't operate.
You can always move around your file using the key commands in Table 18-1.
Key | What It Does |
---|---|
j | Moves cursor down one line. |
k | Moves cursor up one line. |
l | Moves cursor one character to the right. |
h | Moves cursor one character to the left. |
G | Moves cursor to the last line of the file. |
L | Moves cursor to the last line on the screen. |
Ctrl-d | Moves down one screen. |
Ctrl-u | Moves up one screen. |
:n | Moves the cursor to line n. For instance, :1 moves to the first line of the file. |
$ | Moves to the end of the current line. ... |
Get Spring Into Linux® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.