Linux stty command

On Unix-like operating systems, the stty command changes and prints terminal line settings.
This page covers the GNU/Linux version of stty.
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. |
Special characters
* dsusp CHAR | CHAR sends a terminal stop signal once input flushed. |
eof CHAR | CHAR sends an end of file (terminate the input). |
eol CHAR | CHAR ends the line. |
* eol2 CHAR | Alternate CHAR for ending the line. |
erase CHAR | CHAR erases the last character typed. |
intr CHAR | CHAR sends an interrupt signal. |
kill CHAR | CHAR erases the current line. |
* lnext CHAR | CHAR enters the next character quoted. |
quit CHAR | CHAR sends a quit signal. |
* rprnt CHAR | CHAR redraws the current line. |
start CHAR | CHAR restarts the output after stopping it. |
stop CHAR | CHAR stops the output. |
susp CHAR | CHAR sends a terminal stop signal. |
* swtch CHAR | CHAR switches to a different shell layer. |
* werase CHAR | CHAR erases the last word typed. |
Special settings
N | Set the input and output speeds to N bauds. |
* cols N | Tell the kernel that the terminal has N columns. |
* columns N | Same as cols N. |
ispeed N | Set the input speed to N. |
* line N | Use line discipline N. |
min N | With -icanon, set N characters minimum for a completed read. |
ospeed N | Set the output speed to N. |
* rows N | Tell the kernel that the terminal has N rows. |
* size | Print the number of rows and columns according to the kernel. |
speed | Print the terminal speed. |
time N | With -icanon, set read timeout of N tenths of a second. |
Control settings
[-]clocal | Disable modem control signals. |
[-]cread | Allow input to be received. |
* [-]crtscts | Enable RTS/CTS handshaking. |
csN | Set character size to N bits, N is [5..8]. |
[-]cstopb | Use two stop bits per character (one with '-'). |
[-]hup | Send a hangup signal when the last process closes the tty. |
[-]hupcl | Same as [-]hup. |
[-]parenb | Generate parity bit in output and expect parity bit in input. |
[-]parodd | Set odd parity (or even parity with '-'). |
Input settings
[-]brkint | Breaks cause an interrupt signal. |
[-]icrnl | Translate carriage return to newline. |
[-]ignbrk | Ignore break characters. |
[-]igncr | Ignore carriage return. |
[-]ignpar | Ignore characters with parity errors. |
* [-]imaxbel | Beep and do not flush a full input buffer on a character. |
[-]inlcr | Translate newline to carriage return. |
[-]inpck | Enable input parity checking. |
[-]istrip | Clear high (8th) bit of input characters. |
* [-]iutf8 | Assume input characters are UTF-8 encoded. |
* [-]iuclc | Translate uppercase characters to lowercase. |
* [-]ixany | Let any character restart output, not only start character. |
[-]ixoff | Enable sending of start/stop characters. |
[-]ixon | Enable XON/XOFF flow control. |
[-]parmrk | Mark parity errors (with a 255-0-character sequence). |
[-]tandem | Same as [-]ixoff. |
Output settings
* bsN | Backspace delay style, N is [0..1]. |
* crN | Carriage return delay style, N in [0..3]. |
* ffN | Form feed delay style, N in [0..1]. |
* nlN | Newline delay style, N in [0..1]. |
* [-]ocrnl | Translate carriage return to newline. |
* [-]ofdel | Use delete characters for fill instead of null characters. |
* [-]ofill | Use fill (padding) characters instead of timing for delays. |
* [-]olcuc | Translate lowercase characters to uppercase. |
* [-]onlcr | Translate newline to carriage return-newline. |
* [-]onlret | Newline performs a carriage return. |
* [-]onocr | Do not print carriage returns in the first column. |
[-]opost | Post-process output. |
* tabN | Horizontal tab delay style, N in [0..3]. |
* tabs | Same as tab0. |
* -tabs | Same as tab3. |
* vtN | Vertical tab delay style, N in [0..1] |
Local settings
[-]crterase | Echo erase characters as backspace-space-backspace. |
* crtkill | Kill all line by obeying the echoprt and echoe settings. |
* -crtkill | Kill all line by obeying the echoctl and echok settings. |
* [-]ctlecho | Echo control characters in hat notation ('^c'). |
[-]echo | Echo input characters. |
* [-]echoctl | Same as [-]ctlecho. |
[-]echoe | Same as [-]crterase. |
[-]echok | Echo a newline after a kill character. |
* [-]echoke | Same as [-]crtkill. |
[-]echonl | Echo newline even if not echoing other characters. |
* [-]echoprt | Echo erased characters backward, between '\' and '/'. |
[-]icanon | Enable erase, kill, werase, and rprnt special characters. |
[-]iexten | Enable non-POSIX special characters. |
[-]isig | Enable interrupt, quit, and suspend special characters. |
[-]noflsh | Disable flushing after interrupt and quit special characters. |
* [-]prterase | Same as [-]echoprt. |
* [-]tostop | Stop background jobs that try to write to the terminal. |
* [-]xcase | With icanon, escape with '\' for uppercase characters. |
Combination settings
* [-]LCASE | Same as [-]lcase. |
cbreak | Same as -icanon. |
-cbreak | Same as icanon. |
cooked | Same as brkint ignpar istrip icrnl ixon opost isig icanon: eof and eol characters to their default values |
-cooked | Same as raw. |
crt | Same as echoe echoctl echoke. |
dec | Same as echoe echoctl echoke -ixany intr ^c erase 0177 kill ^u. |
* [-]decctlq | Same as [-]ixany. |
ek | Erase and kill characters to their default values |
evenp | Same as parenb -parodd cs7. |
-evenp | Same as -parenb cs8. |
* [-]lcase | Same as xcase iuclc olcuc. |
litout | Same as -parenb -istrip -opost cs8. |
-litout | Same as parenb istrip opost cs7. |
nl | Same as -icrnl -onlcr. |
-nl | Same as icrnl -inlcr -igncr onlcr -ocrnl -onlret. |
oddp | Same as parenb parodd cs7. |
-oddp | Same as -parenb cs8. |
[-]parity | Same as [-]evenp. |
pass8 | Same as -parenb -istrip cs8. |
-pass8 | Same as parenb istrip cs7. |
raw | Same as -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -isig -icanon -xcase min 1 time 0. |
-raw | Same as cooked. |
sane | Same as cread -ignbrk brkint -inlcr -igncr icrnl -iutf8 -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke, all special characters to their default values. |
Handle the tty line connected to standard input. Without arguments, it prints baud rate, line discipline, and deviations from stty sane. In settings, CHAR is taken literally, or coded as in ^c, 0x37, 0177 or 127; special values ^- or undef are used to disable special characters.
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.