Terminal Characteristics

You can specify your terminal type to UNIX if the default is not suitable. To do so, enter the command for the C shell family:

% set term=termtype

or for the Bourne shell family:

$ TERM=termtype; export TERM

where termtype is the name of a terminal type supported on the system. vt100, vt220 and xterms are acceptable terminal types. If you always use the same kind of terminal, you may want to put this command in your .login or .profile.

Like all systems, UNIX has a number of special keys that perform particular functions. Some important ones are the keys necessary to backspace over a character when entering a command, to delete the whole line being entered, and to interrupt execution. These are user-specifiable, and have different defaults based on the shell being used and also on the version of UNIX being used. You can display the existing settings during a session with the stty command:

% stty -a 

The format on each machine is different but should indicate approximately the same information. The following is the output from a Silicon Graphics machine.

speed 9600 baud; line = 1; 24 rows; 80 columns
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = ^@; old-swtch = ^Z; susp = ^Z
lnext = ^V; werase = ^W; rprnt = ^R; flush = ^O; stop = ^S; start = ^Q; dsusp = ^@ 
-parenb -parodd cs8 -cstopb hupcl cread clocal -cnew_rtscts -loblk
-ignbrk brkint -ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc 
ixon ixany -ixoff  imaxbel
isig icanon iexten -xcase echo echoe -echok echoke echoctl -echoprt -echonl -noflsh -flusho pendin -tostop
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel tab3 

The character ^ indicates the control key (e.g., ^C represents <Ctrl-c>).

You can display a description of all of the options reported by stty with the command:

% man stty

If you don't like your defaults, you can also set these functions with the stty command. The form for setting them is:

% stty control-char c 



is one of the functions specified in the stty man page. Some examples include:

  • erase - Erase character. Backspace and erase one character
  • werase - Delete the rightmost word typed in
  • kill - Kill (erase) the line typed in so far
  • intr - Interrupt the program currently running
  • rprnt - Reprint the line typed in so far
  • flush - Stops terminal output until you press a key
  • susp - Suspend the program currently running and put it in the background
  • stop - Stop the display. To resume, press the start key
  • start - Start the display after stop
  • eof - Send the program an end-of-file character

is the representation of the key to be used for that function. A control character is specified preceded by a caret: ^x represents <Ctrl-x>.


% stty erase '^?'

There are two special representations: ^? is interpreted as the delete key and ^- is interpreted as undefined. You must include the quotes as shown in the example so that special characters are not interpreted incorrectly. You must be careful not to have two functions represented by the same key.

There are many other options that can be set with stty. Others that might be of interest are echoe which specifies that deleted characters are erased, and -tabs which specifies that the tab character be translated into the appropriate number of spaces. Refer to the man pages for more information.