USE KEYBOARD
SHORTCUTS AT THE COMMAND LINE
The bash shell offers a lot of power for interacting with the command
line. By default, the shell uses an Emacs-like mode to edit lines,
which you can change to a vi-like mode. The mode you choose largely
depends on which editor you're most comfortable with.
For example, when using the default Emacs-like mode, you can use a
number of [Ctrl] or [Esc] key combinations to navigate and manipulate
text when you're working on a lengthy command. Here's a list of some
of your options:
* Press [Ctrl]B to move backward one character.
* Press [Ctrl]F to move forward one character.
* Press [Esc]B to move one word backward.
* Press [Esc]F to move one word forward.
* Press [Ctrl]A to move to the first character in the line.
* Press [Ctrl]E to move to the end of the line.
* Press [Ctrl]U to delete the current line.
* Press [Ctrl]K to delete from the cursor's current position to the
end of the line.
You can also use a command to search through your history. Press [Ctrl]R
to perform a reverse search through your history for a given command.
When you've located the command, press [Enter] to reexecute it, or
edit the command to change it.
If you frequently work from the command line, using these shortcuts
can save you a lot of time.
|