# info > stty

---
type: CommandReference
command: stty
mode: info
section: 19.2
source: coreutils
---

## Quick Reference

- `stty -a` — Print all current settings in human-readable form.
- `stty -g` — Print settings in a form that can restore them later.
- `stty sane` — Reset terminal to sensible defaults.
- `stty 9600` — Set baud rate to 9600.
- `stty erase ^H` — Set erase character to Ctrl-H.
- `stty raw` — Set raw mode (no processing).
- `stty -F /dev/ttyS0` — Operate on a specific device file.
- `stty size` — Print number of rows and columns.

## Name

`stty` — Print or change terminal characteristics.

## Synopsis

stty [OPTION] [SETTING]...
stty [OPTION]
## Options

### General options

- `-a`, `--all` — Print all current settings in human-readable form. May not be used with line settings.
- `-F DEVICE`, `--file=DEVICE` — Set the line opened by file name DEVICE instead of standard input.
- `-g`, `--save` — Print all current settings in a form that can be used as an argument to another `stty` command to restore them. May not be used with line settings.

### Control settings

- `parenb` — Generate parity bit in output and expect parity bit in input. May be negated.
- `parodd` — Set odd parity (even if negated). May be negated.
- `cmspar` — Use "stick" (mark/space) parity. Non-POSIX. May be negated.
- `cs5`, `cs6`, `cs7`, `cs8` — Set character size to 5, 6, 7, or 8 bits.
- `hup`, `hupcl` — Send a hangup signal when the last process closes the tty. May be negated.
- `cstopb` — Use two stop bits per character (one if negated). May be negated.
- `cread` — Allow input to be received. May be negated.
- `clocal` — Disable modem control signals. May be negated.
- `crtscts` — Enable RTS/CTS flow control. Non-POSIX. May be negated.
- `cdtrdsr` — Enable DTR/DSR flow control. Non-POSIX. May be negated.

### Input settings

- `ignbrk` — Ignore break characters. May be negated.
- `brkint` — Make breaks cause an interrupt signal. May be negated.
- `ignpar` — Ignore characters with parity errors. May be negated.
- `parmrk` — Mark parity errors (with a 255-0-character sequence). May be negated.
- `inpck` — Enable input parity checking. May be negated.
- `istrip` — Clear high (8th) bit of input characters. May be negated.
- `inlcr` — Translate newline to carriage return. May be negated.
- `igncr` — Ignore carriage return. May be negated.
- `icrnl` — Translate carriage return to newline. May be negated.
- `iutf8` — Assume input characters are UTF-8 encoded. May be negated.
- `ixon` — Enable XON/XOFF flow control (Ctrl-S/Ctrl-Q). May be negated.
- `ixoff`, `tandem` — Enable sending stop/start characters when buffer is nearly full/empty. May be negated.
- `iuclc` — Translate uppercase to lowercase. Non-POSIX. May be negated.
- `ixany` — Allow any character to restart output (only start character if negated). Non-POSIX. May be negated.
- `imaxbel` — Beep and do not flush input buffer if full. Non-POSIX. May be negated.

### Output settings

- `opost` — Postprocess output. May be negated.
- `olcuc` — Translate lowercase to uppercase. Non-POSIX. May be negated.
- `ocrnl` — Translate carriage return to newline. Non-POSIX. May be negated.
- `onlcr` — Translate newline to carriage return-newline. Non-POSIX. May be negated.
- `onocr` — Do not print carriage returns in the first column. Non-POSIX. May be negated.
- `onlret` — Newline performs a carriage return. Non-POSIX. May be negated.
- `ofill` — Use fill (padding) characters instead of timing for delays. Non-POSIX. May be negated.
- `ofdel` — Use ASCII DEL for fill instead of ASCII NUL. Non-POSIX. May be negated.
- `nl1`, `nl0` — Newline delay style. Non-POSIX.
- `cr3`, `cr2`, `cr1`, `cr0` — Carriage return delay style. Non-POSIX.
- `tab3`, `tab2`, `tab1`, `tab0` — Horizontal tab delay style. Non-POSIX.
- `bs1`, `bs0` — Backspace delay style. Non-POSIX.
- `vt1`, `vt0` — Vertical tab delay style. Non-POSIX.
- `ff1`, `ff0` — Form feed delay style. Non-POSIX.

### Local settings

- `isig` — Enable interrupt, quit, and suspend special characters. May be negated.
- `icanon` — Enable erase, kill, werase, and rprnt special characters. May be negated.
- `iexten` — Enable non-POSIX special characters. May be negated.
- `echo` — Echo input characters. May be negated.
- `echoe`, `crterase` — Echo erase characters as backspace-space-backspace. May be negated.
- `echok` — Echo a newline after a kill character. May be negated.
- `echonl` — Echo newline even if not echoing other characters. May be negated.
- `noflsh` — Disable flushing after interrupt and quit characters. May be negated.
- `xcase` — Enable input/output of uppercase by preceding lowercase with `\` when `icanon` is set. Non-POSIX. May be negated.
- `tostop` — Stop background jobs that try to write to the terminal. Non-POSIX. May be negated.
- `echoprt`, `prterase` — Echo erased characters backward between `\` and `/`. Non-POSIX. May be negated.
- `echoctl`, `ctlecho` — Echo control characters in hat notation (`^C`). Non-POSIX. May be negated.
- `echoke`, `crtkill` — Echo kill special character by erasing each character. Non-POSIX. May be negated.
- `extproc` — Enable LINEMODE. Non-POSIX. May be negated.
- `flusho` — Discard output. Non-POSIX. May be negated.

### Combination settings

- `evenp`, `parity` — Same as `parenb -parodd cs7`. If negated, same as `-parenb cs8`.
- `oddp` — Same as `parenb parodd cs7`. If negated, same as `-parenb cs8`.
- `nl` — Same as `-icrnl -onlcr`. If negated, same as `icrnl -inlcr -igncr onlcr -ocrnl -onlret`.
- `ek` — Reset erase and kill special characters to default values.
- `sane` — Reset to a sensible default: `cread -ignbrk brkint -inlcr -igncr icrnl icanon iexten echo echoe echok -echonl -noflsh -ixoff -iutf8 -iuclc -ixany imaxbel -xcase -olcuc -ocrnl opost -ofill onlcr -onocr -onlret nl0 cr0 tab0 bs0 vt0 ff0 isig -tostop -ofdel -echoprt echoctl echoke -extproc` and sets all special characters to defaults.
- `cooked` — Same as `brkint ignpar istrip icrnl ixon opost isig icanon`, plus sets eof and eol to defaults if they equal min and time. If negated, same as `raw`.
- `raw` — Same as `-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -icanon -opost -isig -iuclc -ixany -imaxbel -xcase min 1 time 0`. If negated, same as `cooked`.
- `cbreak` — Same as `-icanon`. If negated, same as `icanon`.
- `pass8` — Same as `-parenb -istrip cs8`. If negated, same as `parenb istrip cs7`.
- `litout` — Same as `-parenb -istrip -opost cs8`. If negated, same as `parenb istrip opost cs7`.
- `decctlq` — Same as `-ixany`. Non-POSIX. May be negated.
- `tabs` — Same as `tab0`. Non-POSIX. If negated, same as `tab3`.
- `lcase`, `LCASE` — Same as `xcase iuclc olcuc`. Non-POSIX. May be negated.
- `crt` — Same as `echoe echoctl echoke`.
- `dec` — Same as `echoe echoctl echoke -ixany intr ^C erase ^? kill C-u`.

### Special characters

Set with `name value`. Value can be literal, hat notation (`^C`), or integer (hex with `0x`, octal with `0`, decimal otherwise). `^-` or `undef` disables the character.

- `intr` — Send an interrupt signal.
- `quit` — Send a quit signal.
- `erase` — Erase the last character typed.
- `kill` — Erase the current line.
- `eof` — Send an end of file (terminate input).
- `eol` — End the line.
- `eol2` — Alternate character to end the line. Non-POSIX.
- `discard` — Toggle discarding of output. Non-POSIX.
- `swtch` — Switch to a different shell layer. Non-POSIX.
- `status` — Send an info signal. Not supported on Linux. Non-POSIX.
- `start` — Restart output after stopping.
- `stop` — Stop output.
- `susp` — Send a terminal stop signal.
- `dsusp` — Send a terminal stop signal after flushing input. Non-POSIX.
- `rprnt` — Redraw the current line. Non-POSIX.
- `werase` — Erase the last word typed. Non-POSIX.
- `lnext` — Enter the next character literally. Non-POSIX.

### Special settings

- `min N` — Set minimum number of characters for a read when `-icanon` is set.
- `time N` — Set timeout in tenths of seconds for reads when `-icanon` is set.
- `ispeed N` — Set input speed to N.
- `ospeed N` — Set output speed to N.
- `rows N` — Tell kernel the terminal has N rows. Non-POSIX.
- `cols N`, `columns N` — Tell kernel the terminal has N columns. Non-POSIX.
- `drain` — Apply settings after waiting for pending output to transmit. Enabled by default. May be negated. Non-POSIX.
- `size` — Print rows and columns count from kernel. Non-POSIX.
- `line N` — Use line discipline N. Non-POSIX.
- `speed` — Print terminal speed.
- `N` — Set input and output speeds to N. N can be: 0, 50, 75, 110, 134, 134.5, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, `exta` (19200), `extb` (38400), and higher speeds (57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000) where supported. 0 hangs up the line if `-clocal` is set.

## Examples

Show all current settings:
shell
stty -a
Save current settings to a variable:
shell
SAVED_STTY=$(stty -g)
Restore saved settings:
shell
stty $SAVED_STTY
Set terminal to sane defaults:
shell
stty sane
Set baud rate to 9600:
shell
stty 9600
Set erase character to backspace (Ctrl-H):
shell
stty erase ^H
Enable raw mode:
shell
stty raw
Query terminal size:
shell
stty size
## See Also

- [Common options](https://www.gnu.org/software/coreutils/manual/html_node/Common-options.html) in coreutils
- `tty` (1)
- `setserial` (8)
- `termios` (3)

## Exit Codes

- **0** — Success.
- **Non-zero** — Failure.