← 返回命令列表

Linux command

stty 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Show all settings

stty -a

Show settings for device

stty -a -F [/dev/ttyUSB0]

Set baud rate

stty -F [/dev/ttyUSB0] [115200]

Disable echo

stty -echo

Enable raw mode

stty raw

Reset to sane defaults

stty sane

Set terminal size

stty rows [24] cols [80]

说明

stty displays or changes terminal line settings. It controls various aspects of terminal I/O including baud rate, character processing, and signal handling. The tool is essential for configuring serial ports and customizing terminal behavior.

参数

-a, --all
Print all settings.
-g, --save
Print in stty-readable form.
-F _device_, --file=_device_
Open and use the specified device instead of stdin.
sane
Reset to sane values.
raw
Raw mode (no processing).
cooked
Normal mode (opposite of raw).
echo / -echo
Enable/disable echoing of input characters.
rows _n_
Set terminal rows.
cols _n_
Set terminal columns.
ispeed _n_
Set input baud rate.
ospeed _n_
Set output baud rate.
ixon / -ixon
Enable/disable START/STOP output control.
ixoff / -ixoff
Enable/disable sending of START/STOP characters.
crtscts / -crtscts
Enable/disable RTS/CTS hardware flow control.
cstopb / -cstopb
Use two stop bits per character (one with '-').

FAQ

What is the stty command used for?

stty displays or changes terminal line settings. It controls various aspects of terminal I/O including baud rate, character processing, and signal handling. The tool is essential for configuring serial ports and customizing terminal behavior.

How do I run a basic stty example?

Run `stty -a` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --all do in stty?

Print all settings.