Master `stty` for Taming Terminal Echo

Quick Tip

Master `stty` for Taming Terminal Echo

Challenge: Sometimes, when scripting or interacting with serial devices, you need precise control over how characters are displayed on the terminal. Specifically, you might want to disable or re-enable the echoing of input characters for security or specific application needs.

The Solution: The `stty` command is your go-to for controlling terminal line settings, including echo.

# To disable echo stty -echo # To re-enable echo stty echo

Why it works: `stty -echo` tells the terminal driver to stop sending input characters back to the screen, which is useful for hiding passwords or sensitive input. `stty echo` reverses this behavior, restoring normal terminal input display.

Pro-Tip: You can combine these with `read` for secure password input in scripts: `read -p “Enter password: ” -s MY_PASS; echo; echo “Your password was: $MY_PASS”`. The `-s` flag disables echo for the `read` command itself.

Linux Tips & Tricks | © ngelinux.com | 5/7/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments