Linux Use stty Display to Modify Terminal Line Settings
- 2021-08-31 09:49:31
- OfStack
stty is a common command for changing and printing terminal settings under linux.
1. Parameters:
1. Print terminal line settings
-a,--all prints all current settings in a human-readable manner; -The a parameter outputs more detailed terminal information than the stty command alone
-g,--save Print all current settings in stty readable mode
-F, --file=DEVICE Turn on and use a specific device (DEVICE) instead of standard input (stdin)
--help displays help and exits
--version displays version and exits
2: Usage
1. Number of rows and columns of stty size print terminal
2. Disable lowercase output at the command line
stty olcuc # ON
stty-olcuc # Recovery
3. Print out the number of rows and columns of the terminal
stty size
4. The method of changing ctrl+D:
stty eof "string"
The system defaults to ctrl+D to indicate the end of the file, which can be changed in this way!
5. Shielding display
stty-echo # No Echo
stty echo # Turn on Echo
Test method:
stty -echo;read;stty echo;read
6. Ignore carriage returns
stty igncr # ON
stty-igncr # Recovery
7. Use it to set up our serial port to print operation information.
stty -F /dev/ttyS0 speed 115200 cs8 -parenb -cstopb -echo
Explanation: Setting/dev/ttyS0 serial port through stty, baud rate is 115200, data bit cs8, parity bit-parenb, stop bit-cstopb, and-echo prohibits terminal echo.