Go to the first, previous, next, last section, table of contents.


Interactive Input

When used interactivly, the shell provides some assistance to help you enter the command that you want to enter with as few key strokes as possible. This assistance is provided in three ways: by enabling you to edit the line you have typed, by enabling you to recall parts of previous commands into the current command, and by allowing you to browse the file system, and insert the names of existing files into the command line.

Command Line Editting

The shell provides a command line editor which allows the command being entered to be editted. When a multiline command is being entered, the whole command can be editted, not just the last line. Only the line currently being edited is displayed however.

The editting command are similar to the basic character editting available in the emacs editor. The symbol `C-l' for some character l is pronounced `Control l' and is generated by holding down the the `Control' key while typing l. The symbol `M-l' for some character l is pronounced `Meta l' and is generated by typing `ESC' then l, or by typing l while the `meta' key is held down (if you have a working `meta' key.

On ANSI compatable terminals (e.g. vt100, xterm) the arrow keys are understood and to the "obvious" thing.

`C-m'
`C-j'
`Return'
Enter the current line. If the line completes a command, then the command will be obeyed. If not, then the shell will wait for another line of input.
`C-a'
Go the the start of the current line (just after the prompt).
`C-y'
Insert the current contents of the paste buffer. The past buffer is explained later.
`C-p'
Move to the previous line of a multi line command. If this command is typed before any partial command has been enter, the command line editor enters history mode as described below.
`C-n'
Move to the next line of a multi line command.
`C-e'
Move to the end of the current line.
`C-h'
`BackSpace'
Delete the character before the cursor.
`C-d'
If at the end of the line, to the same a `TAB' (which is the Do-What-I-Mean key), otherwise delete the character after the cursor.
`C-f'
Move forward one character.
`C-b'
Move backward one character.
`C-o'
Insert a newline after the cursor. The rest of the line will disappear, but can be found by going to the next line (`C-n').
`C-t'
Twiddle the current and previous characters. i.e. the character after the cursor gets swapped with the character before the cursor.
`C-k'
Kill all characters up to the end of the line.
`C-w'
Delete characters back to the beginning of a word.
`M-u'
`C-u'
Change all following letters up to the end of a word to upper case.
`M-l'
`C-l'
Change all following letters up to the end of a word to lower case.
`C-i'
`Tab'
Perform filename completion, filename expansion, or enter history browsing mode, depending on the word before the cursor. This is explained in more detail below. This is the Do-What-I-Mean key.
`C-v'
The next character typed is entered into the command line, even if it is a control character.
`C-x'
Delete all character before the cursor.
`C-r'
Redraw the current line being edited.
`C-s'
`C-\'
Search for a given character on the current line. For each subsequent printable character typed, the cursor will move, either forward or backward, to find that character on the line. If it is not found the cursor will move as far as it can (to the beginning or end) and the search direction will change. Search mode will be exitted when a non-printable character is typed.
`M-b'
Move backward to the beginning of a word.
`M-f'
Move forward to the beginning of a word.
`M-e'
Move forward to the end of a word.
`M-d'
Delete characters forward to the end of a word.
`M-C-h'
`M-BackSpace'
Delete characters backwards to the start of a word.
`M-C-I'
`M-Tab'
Perform hostname completion on the word before the cursor.

Do What I Mean

The command line editor provides a Do What I Mean key which attempts to deduce what you are trying to enter, and helps you to enter it. This key is the TAB key.

When this key is pressed, the editor scans backward until it finds something that it understands. This will be either a history specifier (if an exclamation point is found), or a file or command name.

If it appears to be a command name or file name, but the command/file cannot be found, the history is scanned for a word which contains the text behind the cursor, and that text is replaced by the word found.

History Expansion

File name and command completion and listing

Host name completion


Go to the first, previous, next, last section, table of contents.