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...
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....
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...
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...
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:
$ stty
speed 38400 baud; line = 0;
$ stty erase ^H # Let the key combination Ctrl+H (in caret notation ^H) erase
$ #+ the last character typed.
$ stty
speed 38400 baud; line = 0;
erase = ^H;
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:
!/bin/bash
Reading a password without echoing it while typed
old_term_settings=$(stty -g) # Save all current terminal settings.
stty -echo # Turn off screen echo.
read -p 'Password: ' secret_passwd # Non-bash: `echo -n 'Password: '; read secret_passwd'.
echo
echo Your password is ${secret_passwd}.
stty "$old_term_settings" # Restore all previous settings.
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:
stty -F /dev/pts/13 rows 35 columns 59
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):
$ stty sane
The source of this article is wikipedia, the free encyclopedia. The text of this article is licensed under the GFDL.