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.
1I'll just comment instead of answer because I'm a bit sketchy, but before intranets and internet, terminals all connected to the main computer via a serial cable and the ports speed or baud rate would have to be configured to match the termial/printer etc connected on the line. Modem's had special significance because they might have had different baud rates depending on the connection. Also today hobbyist's sometimes have the need (ie raspberry pi) – Tyson – 2014-09-10T04:32:03.213
So should I draw the conclusion that on the modern computer that I am working, changing baud settings won't affect how the terminal is displaying the output? – Gaurav – 2014-09-10T04:46:55.887
2Exactly... Unless you're using a hardware terminal, it should make no difference.
stty
can just turn knobs that don't apply to virtual terminals. – neersighted – 2014-09-10T04:49:35.173