2.2.3. Using Bash features
Several special key combinations allow you to do things easier
and faster with the GNU shell, Bash, which is the default on almost any Linux
Section 184.108.40.206. Below is a list of the most commonly used features;
you are strongly suggested to make a habit out of using them, so as
to get the most out of your Linux experience from the very
Table 2-2. Key combinations in Bash
|Key or key combination
||Move cursor to the beginning of
the command line.
||End a running program and return
the prompt, see
||Log out of the current shell
session, equal to typing exit or logout.
||Move cursor to the end of the
||Generate backspace character.
||Clear this terminal.
||Search command history, see
||Suspend a program, see
||Move the cursor one place to the
left or right on the command line, so that you can insert
characters at other places than just at the beginning and the
||Browse history. Go to the line
that you want to repeat, edit details if necessary, and press
Enter to save time.
|Shift+PageUp and Shift+PageDown
||Browse terminal buffer (to see
text that has "scrolled off" the screen).
||Command or filename completion;
when multiple choices are possible, the system will either signal
with an audio or visual bell, or, if too many choices are possible,
ask you if you want to see them all.
||Shows file or command completion
The last two items in the above table may need some extra
explanantions. For instance, if you want to change into the
directory directory_with_a_very_long_name, you are not going
to type that very long name, no. You just type on the command line
cd dir, then you press Tab and the shell completes the name for you, if no
other files are starting with the same three characters. Of course,
if there are no other items starting with "d", then you might just as wel type cd d and then Tab. If more than
one file starts with the same characters, the shell will signal
this to you, upon which you can hit Tab twice
with short interval, and the shell presents the choices you
your_prompt> cd st
starthere stuff stuffit
In the above example, if you type "a"
after the first two characters and hit Tab
again, no other possibilities are left, and the shell completes the
directory name, without you having to type the string "rthere":
your_prompt> cd starthere
Of course, you'll still have to hit Enter
to accept this choice.
In the same example, if you type "u",
and then hit Tab, the shell will add the
"ff" for you, but then it protests
again, because multiple choices are possible. If you type Tab Tab again, you'll see the
choices; if you type one or more characters that make the choice
unambiguous to the system, and Tab again, or
Enter when you've reach the end of the file
name that you want to choose, the shell completes the file name and
changes you into that directory - if indeed it is a directory
This works for all file names that are arguments to
The same goes for command name completion. Typing ls and then hitting the Tab key
twice, lists all the commands in your PATH
that start with these two characters:
ls lsdev lspci lsraid lsw
lsattr lsmod lspgpot lss16toppm
lsb_release lsof lspnp lsusb