Previous Table of Contents Next



BSD (Berkeley)
The value of c may be set to NULL (undefined) by using "u" or "undef."
eof
erase
intr
kill
quit Same as SV
brk c Set the break character to c. The default is NULL (undefined).
cols n
 columns n
Sets the number of columns assumed on the terminal to n.
rows n Sets the number of rows assumed on the terminal to n.
start c Set the start character to c. The default is Ctrl-Q. This allows you to start output to your terminal that has been stopped by the stop character (Ctrl-S).
stop c Set the stop character to c. The default is Ctrl-S. This allows you to stop output to your terminal.
tilde (-tilde) (Do not) Convert the tilde character (~) to acute accent (`).

Combination Modes  The following terminal options are aliases for common combinations of previously defined terminal options.

nl Unsets the incrnl and onlcr terminal options.
-nl Sets incrnl and onlcr and unsets inlcr, igncr, ocrnl, and onlret.
LCASE (-LCASE)
 lcase (-lcase)
Sets (unsets) the xcase, iuclc, and olcuc terminal options.
tabs
 (-tabs or tab8)
Expands tabs to the equivalent number of spaces when on output.
ek Resets the kill character to @ and the erase character to #.
sane Resets the tty device driver terminal options to some reasonable values. This is useful if you have to kill a program with a kill -9 PID command and the program has reset some of the terminal options.

BSD (Berkeley)
ek
lcase (-lcase)
nl (-nl)
raw
 (-raw or cooked)
Same as SV
crt Sets options for a CRT. The crtbs, crtecho (if the baud rate >=1200), crterase, and crtkill are set.
dec Sets all modes suitable for Digital Equip. Corp. users (erase=Ctrl-?, kill=Ctrl-U, intr=Ctrl-C, and the decctlq and newcrt modes are set).

NEW TTY DRIVER MODES

The following modes (tty settings) are only applicable to the new BSD tty device driver. Usually they are not changed. The new device driver is used by specifying stty new.


BSD (Berkeley)
susp c Set the suspend process character to c. The default is Ctrl-Z.
dsup c Set the delayed suspend process character to c. The default is Ctrl-Y.
rprnt c Set the reprint line character to c. The default is Ctrl-R. Redraws the command line. Useful when output from a background job or other user has garbled your command line.
flush c Set the flush output character to c. The default is Ctrl-O. Flushes all currently held output to your terminal.
werase c Set the erase word character to c. The default is Ctrl-W. If you press the Ctrl-W on the command line, the previous word is erased.
inext c Set the literal next character to c. The default is Ctrl-V. This allows you to enter a character with special meaning to the device driver on the command line. For example, Ctrl-R normally redraws the command line. But Ctrl-V Ctrl-R inserts the Ctrl-R on the command line.

RELATED COMMANDS

  Refer to the tabs command described in Module 130.

RELATED FILES

  The stty command sends control signals to the device driver you are currently logged into the system through.

APPLICATIONS

The stty command has many options you can use to change how the computer system communicates with your terminal. Most of the terminal options described are set automatically to the proper setting. You can, however, reset some of the options to customize how the system communicates with your terminal. For example, the local modes, control characters, and the combination modes are often used to reset how the terminal device driver functions, thus changing how the terminal acts.

The most common use of the stty command is to reset your erase and kill characters. Some people reset a few other options but, for the most part, the default settings handle all of the typical user's requirements.

The echo option is sometimes used in shell scripts to turn off echoing when you want to read in a password or some type of encryption key and you do not want the input to be displayed on the screen. For example,

     cj> cat readpasswd
     stty -echo
     echo "Enter database password: \c"
     read PSWD
     stty echo

might be used to read in a password without having the password displayed while it is being typed by the user.

The stty command may also be used by the super-user to change the settings of a tty other than the one currently logged in on. For example,

     cj> stty 9600 < /dev/tty09

resets the baud rate for tty09 to 9600. The command

     cj> stty -a < /dev/tty09

displays all settings for tty09. On some systems you have to use output redirection (>) instead of input redirection (<) to access a tty other than yours.

TYPICAL OPERATION

In this activity you use the stty command to display the current settings of your tty device driver. Then change options to show how the stty command can affect how your terminal communicates to the UNIX system. Begin at the shell prompt.

1.  Type stty and press Return. The output describes the current settings of how the terminal device driver for your terminal is set.
     cj> stty
     speed 9600 baud; -parity hupcl susp = ^Z; dsup = ^Y
     erase = #; kill = @; swtch = ^@;
     icrnl onlcr tab3
     echo -echoe echok
2.  Now type stty -echo and press Return.
3.  Type stty echo and press Return. Notice the characters you type are not echoed on your terminal screen. This is because the echo terminal option has been disabled. Thus the system is not echoing your characters back to your terminal. The stty echo command enables the echo feature.
4.  Type stty erase ^h kill ^u and press Return. Note the ^ is a caret not a control character representation.
5.  Type stty and press Return to display your terminal settings again. Depending on the original settings displayed in step one you should see about the same definitions except for the kill character.
     cj> stty
     speed 9600 baud; -parity hupcl susp = ^Z; dsup = ^Y
     erase = ^H; kill = ^U; swtch = ^@;
     icrnl onlcr tab3
     echo -echoe echok

You have completed the learning sequence.


Previous Table of Contents Next