Stty
Encyclopedia
The Unix
stty command
is used for changing the settings of a Unix computer terminal
. This command is used to change keystrokes, irregular character handling, and more. Stty gives a full set of features that are also available in ncurses
for programmers but simplifies it by building it in to a simple-to-use Unix command. Now it is rarely used due to reduced use of command lines and UART/RS-232
serial port
s.
(a non-Posix
setting) and settings that deviate from the values set by stty sane:
To list current terminal line settings:
An example of stty is stty -echo which turns off echoing
in the terminal meaning nothing you type will get printed (stty echo to turn the echo back on). An example of that command in a shell script
that stores terminal settings, reads the user's password without echoing it and restores the terminal settings:
To change the row and column size of pseudo terminal
pts/13:
And to restore the TTY device to normal settings (same as stty cread -ignbrk brkint -inlcr -igncr icrnl -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke):
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
stty command
Command (computing)
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell....
is used for changing the settings of a Unix computer terminal
Computer terminal
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system...
. This command is used to change keystrokes, irregular character handling, and more. Stty gives a full set of features that are also available in ncurses
Ncurses
ncurses is a programming library that provides an API which allows the programmer to write text user interfaces in a terminal-independent manner. It is a toolkit for developing "GUI-like" application software that runs under a terminal emulator...
for programmers but simplifies it by building it in to a simple-to-use Unix command. Now it is rarely used due to reduced use of command lines and UART/RS-232
RS-232
In telecommunications, RS-232 is the traditional name for a series of standards for serial binary single-ended data and control signals connecting between a DTE and a DCE . It is commonly used in computer serial ports...
serial port
Serial port
In computing, a serial port is a serial communication physical interface through which information transfers in or out one bit at a time...
s.
Example
A lone stty command gives the baud rate, the line-discipline numberLine discipline
A line discipline is a layer in the terminal subsystem in some Unix-like systems. The terminal subsystem consists of three layers: the upper layer to provide the character device interface, the lower hardware driver to communicate with the hardware or pseudo terminal, and the middle line...
(a non-Posix
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...
setting) and settings that deviate from the values set by stty sane:
To list current terminal line settings:
An example of stty is stty -echo which turns off echoing
Echo (computing)
In computing, echo is a command in DOS, OS/2, Microsoft Windows, Singularity, Unix and Unix-like operating systems that places a string on the computer terminal...
in the terminal meaning nothing you type will get printed (stty echo to turn the echo back on). An example of that command in a shell script
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...
that stores terminal settings, reads the user's password without echoing it and restores the terminal settings:
To change the row and column size of pseudo terminal
Pseudo terminal
In some operating systems, including Unix, a pseudo terminal is a pseudo-device pair that provides a text terminal interface without an associated device, such as a virtual console, computer terminal or serial port...
pts/13:
And to restore the TTY device to normal settings (same as stty cread -ignbrk brkint -inlcr -igncr icrnl -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke):