LinuxCommandLibrary

stty

TLDR

Show all settings

$ stty -a
copy
Show settings for device
$ stty -a -F [/dev/ttyUSB0]
copy
Set baud rate
$ stty -F [/dev/ttyUSB0] [115200]
copy
Disable echo
$ stty -echo
copy
Enable raw mode
$ stty raw
copy
Reset to sane defaults
$ stty sane
copy
Set terminal size
$ stty rows [24] cols [80]
copy

SYNOPSIS

stty [options] [settings...]

DESCRIPTION

stty displays or changes terminal line settings. It controls various aspects of terminal I/O including baud rate, character processing, and signal handling.
The tool is essential for configuring serial ports and customizing terminal behavior.

PARAMETERS

-a, --all

Print all settings.
-g, --save
Print in stty-readable form.
-F device
Specify device.
sane
Reset to sane values.
raw
Raw mode (no processing).
cooked
Normal mode.
echo/-echo
Enable/disable echo.
rows n
Set terminal rows.
cols n
Set terminal columns.
speed baud
Set baud rate.

CAVEATS

Settings affect current terminal. Some require appropriate privileges. Raw mode disables many features. Changes may not persist.

HISTORY

stty (set tty) is a traditional Unix utility dating back to early Unix versions. It remains essential for serial communication and terminal configuration.

SEE ALSO

tty(1), setserial(8), getty(8), termios(3)

Copied to clipboard