Tame Your Terminal Echo with `stty`

Quick Tip

Tame Your Terminal Echo with `stty`

Challenge: When typing commands or scripts, you might want to temporarily disable the echoing of characters to the terminal. This can be useful for security reasons (e.g., masking passwords when prompted) or for creating more custom interactive prompts.

The Solution: The `stty` command can be used to control terminal settings, including echoing.

stty -echo

Why it works: The `-echo` option tells the terminal driver to stop displaying characters as they are typed. To re-enable echoing, you can use `stty echo`.

Pro-Tip: Combine `stty -echo` with `read -p “Enter password: ” password` and then `stty echo` afterward for secure password input in your scripts.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted