p. 25
2.11 Command-Line Editing
As you play with the shell, notice that you can edit the command line using the left and right arrow keys, as well as page through previous commands using the up and down arrows. This is standard on most Linux systems.
However, it’s a good idea to forget about the arrow keys and use control key combinations instead. If you learn the ones listed in Table 2-2, you’ll find that you’re better able to enter text in the many Unix programs that use these standard keystrokes.
Table 2-2: Command-Line Keystrokes
| Keystroke | Action |
|---|---|
| CTRL-B | Move the cursor left |
| CTRL-F | Move the cursor right |
| CTRL-P | View the previous command (or move the cursor up) |
| CTRL-N | View the next command (or move the cursor down) |
| CTRL-A | Move the cursor to the beginning of the line |
| CTRL-E | Move the cursor to the end of the line |
| CTRL-W | Erase the preceding word |
| CTRL-U | Erase from cursor to beginning of line |
| CTRL-K | Erase from cursor to end of line |
| CTRL-Y | Paste erased text (for example, from CTRL-U) |