stty
gets/sets IO characteristics of terminals, both physical and virtual. Because of this, it can set parameters that will have no actual effect, like the baud rate of a virtual terminal.
First you have to understand the types of terminal on Linux systems:
Most of the terminals you will see will be pseudo (virtual) terminals, and live in /dev/pts
. These are sometimes called ptys for short. Any sort of software terminal lives here, whether it be a remote login via SSH or a local terminal emulator.
A tty (/dev/ttyX
) is a local console emulated by the Linux kernel. This is the kind of terminal you use in Linux's virtual terminals. getty
is the program used to show a login prompt and start a shell on these terminals.
A serial or USB serial tty (/dev/ttySX
, /dev/ttyUSBX
) has a real baud rate setting, and corresponds to real hardware. This is the real reason stty
has a baud rate setting, and unlike virtual terminals, will be affected by changes you make to the baud rate.
stty
can just turn knobs that don't apply to virtual terminals.