Linux Commands

How to Use Linux Stty Command?

In Linux-like systems, a user can do anything like communicating with the system or opening up files using the terminal. Everything in the Linux system is represented as a file or directory.

If we talk about the terminal, another term of this command-line interface is tty, which is short for “teletype”. The terminal is a command-line interface that allows the user to communicate with the machine and display the generated output in it.

There is also a command called “stty” on UNIX-like operating systems, an abbreviated form of “Set Teletype”. This command manages terminal settings and allows a user to make changes on the terminal and display terminal line characteristics.

The syntax of the “stty” command is:

stty [-F DEVICE | --file=DEVICE] [SETTINGS]

stty [-F DEVICE | --file=DEVICE] [-a |--all]

stty [-F DEVICE | --file=DEVICE] [-g |--save]

The “stty” Commands Options:

The “stty” Linux command tool supports the following options:

Option Description
-a , –all Display all the current settings in the Human-Readable Format
-g , –save Display all the current settings of the terminal in sttl Readable Format
-F , –file=DEVICE Execute the settings of the specified device by opening it
–help Display the help information about stty command and exit
–version Display the current version of the stty command

How to Use stty Command?

Execute the “stty” command without passing any argument to display the characteristics of terminal:

$ stty

How to Use “stty” Command Options?

Run the options of “stty” command in the following way to get the required output:

“-a” option

Execute the given command to display the current settings of a terminal in a human-readable format:

$ stty --all

-g option

Run the “-g” or “–save” option in the command-line to get the output in the stty-readable format:

$ stty –g

-F option

Use the “-F” option in a terminal and pass the device file as an argument:

$ stty -F /dev/pts/0

–help option

Get the details of the “stty” command and its options using the “–help” option:

$ stty --help

–version option

Get the current version of the “stty” command using the following command:

$ stty --version

Conclusion

The “stty” command is used to make changes and display the characteristics of the terminal. In this article, we have seen a guide of “stty” command and its options.

About the author

Syeda Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.