Tame Your Terminal Echo with `stty`
Quick Tip
Tame Your Terminal Echo with `stty`
Challenge: When typing sensitive information like passwords in the terminal, or when you want to prevent accidental display of characters (e.g., in shared sessions), you might want to temporarily disable character echoing.
The Solution: Use the `stty -echo` command to disable terminal echoing and `stty echo` to re-enable it.
stty -echo read -p "Enter password: " password stty echo echo "Password entered."
Why it works: The `stty` command controls terminal line settings. The `-echo` flag tells the terminal not to display the characters you type, while `echo` restores the default behavior.
Pro-Tip: You can also use `stty sane` to reset all terminal settings to their defaults, which will re-enable echo if it was accidentally disabled.
Linux Tips & Tricks | © ngelinux.com | 6/28/2026
