About stty:
stty changes and prints
terminal
line settings.
Description
stty displays or changes the characteristics of the
terminal.
Syntax
stty [-F DEVICE | --file=DEVICE] [SETTING]...
stty [-F DEVICE | --file=DEVICE] [-a|--all]
stty [-F DEVICE | --file=DEVICE] [-g|--save]
Options
-a, --all
|
print all current settings in human-readable form
|
-g, --save
|
print all current settings in a stty-readable form
|
-F, --file=DEVICE
|
open and use the specified DEVICE instead of stdin
|
--help
|
display a help message, and exit
|
--version
|
output version information, and exit
|
Examples:
stty sane
Reset all terminal settings to "sane" values; this has the
effect of "fixing" the terminal when another program alters
the terminal settings to an unusable condition.
stty -echo
Disable echoing of terminal input.
stty echo
Re-enable echoing of terminal input.
stty -a
Display all current terminal settings.
Another Examples:
- To display a short listing of your workstation configuration,
type:
stty
This lists settings that differ from the defaults.
- To display a full listing of your workstation configuration,
type:
stty
-a
- To enable a key sequence that stops listings from scrolling
off the screen, type:
stty ixon ixany
This sets ixon mode, which lets you stop runaway
listing by pressing the Ctrl-S key sequence. The ixany
flag allows you to resume the listing by pressing any key. The
normal workstation configuration includes the ixon
and ixany flags, which allows you to stop a listing
with the Ctrl-S key sequence that only the Ctrl-Q key sequence will
restart.
- To reset the configuration
after it has been messed up, type:
Ctrl-J stty
sane Ctrl-J
Press the Ctrl-J key sequence before and after the command
instead of the Enter key. The system usually recognizes the Ctrl-J
key sequence when the parameters that control Enter key processing
are messed up.
Sometimes the information
displayed on the screen may look strange, or the system will not
respond when you press the Enter key. This can happen when you use
the stty command with parameters that are
incompatible or that do things you don't understand. It can also
happen when a screen-oriented application ends abnormally and does
not have a chance to reset the workstation configuration.
Entering the stty sane
command sets a reasonable configuration, but it may differ slightly
from your normal configuration.
- To save and restore the
terminal's configuration:
OLDCONFIG=`stty -g` # save configuration
stty -echo # do not display password
echo "Enter password: \c"
read PASSWD # get the password
stty $OLDCONFIG # restore configuration
This command saves the workstation's configuration, turns off
echoing, reads a password, and restores the original configuration.
Entering the stty -echo
command turns off echoing, which means that the password does not
appear on the screen when you type it at the keyboard. This action
has nothing to do with the echo command, which
displays a message on the screen.
No comments:
Post a Comment