Special Characters

When you use a Unix system, there are several control characters that you should know about. Precisely which characters is a characteristic of your terminal. You can change these mappings using the stty program. Type stty at the prompt with no arguments to view your current mappings. In the table below the '^' character means you need to press and hold the control key (often labeled as "ctrl") while pressing the following letter.

Table 1.1. Special Control Characters

^DThis character is used to signal the end-of-file condition (EOF). Many Unix programs read their standard input (the keyboard) until they encounter an EOF. Type ^D to send an EOF to the program. If a program appears stuck, try typing ^D at it.
^CThis is the interrupt character. This will usually abruptly terminate a program that's stuck in an infinite loop.
^SOn ordinary terminals, ^S usually pauses the scrolling. This is the XOFF character.
^QNormally ^Q (XON) restarts scrolling after a ^S.
^UThis character causes the current line to be erased. It is sometimes called the kill character.

If you are using the Korn Shell, and if your EDITOR environment variable is set to "emacs", the shell will accept emacs commands for editing the command line. In particular, ^F and ^B will move the cursor on the current command. ^P and ^N will let you step throught your command history. Depending on the terminal you are using, you may be able to use the arrow keys for these functions as well.

One issue that causes a lot of confusion relates to the DEL and BACKSPACE characters. People normally want the character to the left of the cursor to be deleted when they press the backspace key on their keyboard. However, some systems will execute a destructive delete only when they receive a DEL character (ASCII 127). This means that you may need to configure your terminal or terminal emulation software so that it sends a DEL character when you press the backspace key and not the backspace character (ASCII 8). As an alternative, it may be possible to configure your host to do a destructive backspace when it receives the backspace character. You can use the stty command to configure this.

$ stty erase '^?'

This will cause a DEL character to do a destructive backspace.

$ stty erase '^h'

This will cause a backspace character to do a destructive backspace.