stty - set or print terminal characteristics
$ stty [-a] [-g] [-F device] [setting...]stty sets or displays terminal settings for the current terminal or a specified terminal device. Without arguments, it prints the current terminal settings. With settings specified, it applies those settings to the terminal.
-a, --all: Print all current terminal settings in human-readable format, including default values-g, --save: Print current terminal settings in a stty-readable format suitable for later restoration-F device, --file device: Operate on the specified device instead of stdinThe -g and -a options are mutually exclusive.
Settings can be specified in several ways. To disable a setting, prefix it with a dash (-).
sane: Reset all terminal settings to sensible defaultsraw: Enable raw mode (disable all input and output processing)nl: Disable ICRNL (don't translate carriage return to newline)-nl: Enable ICRNL (translate carriage return to newline)ek: Reset erase and kill characters to their default valuesevenp, parity: Enable even parity (7-bit characters)oddp: Enable odd parity (7-bit characters)-parity, -evenp, -oddp: Disable parity (8-bit characters)Specify a numeric value to set both input and output baud rates:
50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000
ispeed N: Set input baud rate to N
ospeed N: Set output baud rate to N
rows N: Set terminal height to N rowscolumns N, cols N: Set terminal width to N columnsControl characters can be set using various formats:
intr: Interrupt character (default: ^C)quit: Quit character (default: ^\)erase: Erase character (default: ^?)kill: Kill line character (default: ^U)eof: End-of-file character (default: ^D)swtc: Switch characterstart: Start output character (default: ^Q)stop: Stop output character (default: ^S)susp: Suspend character (default: ^Z)eol: End-of-line characterreprint: Reprint line character (default: ^R)discard: Discard output character (default: ^O)werase: Word erase character (default: ^W)lnext: Literal next character (default: ^V)eol2: Alternate end-of-line charactermin: Minimum number of characters for non-canonical readtime: Timeout in deciseconds for non-canonical readControl character values can be specified as:
a^C (Ctrl+C)0x03033^- or undefignbrk: Ignore break conditionbrkint: Signal on breakignpar: Ignore parity errorsparmer: Mark parity errorsinpck: Enable input parity checkingistrip: Strip high bit from input charactersinlcr: Translate newline to carriage return on inputigncr: Ignore carriage return on inputicrnl: Translate carriage return to newline on inputiuclc: Translate uppercase to lowercase on inputixon: Enable XON/XOFF flow control on outputixany: Allow any character to restart outputixoff: Enable XON/XOFF flow control on inputimaxbel: Ring bell when input queue is fulliutf8: Assume input is UTF-8opost: Enable output processingolcuc: Translate lowercase to uppercase on outputonlcr: Translate newline to carriage return-newline on outputonlret: Newline performs carriage return functionofill: Use fill characters for delaysofdel: Use DEL instead of NUL for fill characterscs5, cs6, cs7, cs8: Set character size to 5, 6, 7, or 8 bitscstopb: Use two stop bits (one with -)cread: Enable receiverparenb: Enable parity generation and detectionparodd: Use odd parity (even with -)hupcl: Hang up modem on last closeclocal: Ignore modem control linesisig: Enable interrupt, quit, and suspend special charactersicanon: Enable canonical input (erase and kill processing)echo: Echo input charactersechoe: Echo erase character as backspace-space-backspaceechok: Echo newline after kill characterechonl: Echo newline even if not echoing other charactersnoflsh: Don't flush after interrupt and quit characterstostop: Send SIGTTOU for background outputiexten: Enable extended input processingDisplay current terminal settings:
$ stty
speed 38400 baud; rows 24; columns 80;Save terminal settings for later restoration:
$ stty -g > saved_settings
$ stty intr ^X # Make some changes (changes the interrupt key to Ctrl + X)
$ stty $(cat saved_settings) # Restore settingsSet the terminal to raw mode:
$ stty rawSet the baud rate to 115200:
$ stty 115200Set the terminal size:
$ stty rows 30 cols 100Reset terminal to sane defaults:
$ stty sane