Shell tips

The shell tips chapter provides handy tricks that you may wish to use when you are using a GNU/Linux shell (the command-line interface). This information includes handy shortcut key combinations, the shell's command history and information on virtual terminals.

If you can't boot into your system

If your having problems booting into your system you may like to use a shell so you can boot into your system and attempt to fix things up again.

To do this you need to pass the “init=/bin/sh” to your system before you boot up.

If you don't know how to do this please see Chapter 14, the technique is the same except this time you pass "init=bin/sh" rather than "single".

General Shell Tips

Automatic Command Completion

alias

set -x

\ (backslash)

script

~ (tilde character)

set bell-style none

reset

exit

logout

echo

The command-line history

Using the command history

The history command

Searching through the Command History ( CTRL-R )

Other Key combinations

GNU/Linux shells have many shortcut keys which you can use to speed up your work, below is a rough list of some (also see CTRL-R in the history section of the commands, over here, Section 4.2).

CTRL-D

CTRL-Z

CTRL-A and CTRL-E

CTRL-K

CTRL-Y

CTRL-W

Virtual Terminals and screen

Using the key combination ALT-F* keys you may change to different virtual terminals. You will have several (usually 6) virtual terminals setup with shells. Number 7 is usually setup with X you need to use CTRL-ALT-F* to change to a terminal from within X (X as in the X windowing system).

screen

  1. This information was adopted (with editing) from Mandrakesoft's Command Line Manual, see [7] in the Bibliography for further information. (1)