Tame Your Terminal Echo: Control Input Display with `stty`
Quick Tip
Tame Your Terminal Echo: Control Input Display with `stty`
Challenge: Sometimes, especially in scripts or when dealing with sensitive input, you might want to control whether characters typed into the terminal are displayed on the screen. This is known as terminal echo.
The Solution: The `stty` command allows you to manipulate terminal settings, including echo.
# Turn off echo (characters typed will not be displayed) stty -echo # Turn on echo (characters typed will be displayed) stty echo
Why it works: `stty` is a utility that controls the characteristics of the terminal line. The `-echo` option disables the local echoing of input characters, and `echo` re-enables it. This is particularly useful for password prompts in shell scripts.
Pro-Tip: To temporarily disable echo for a password prompt in a script, you can use `stty -echo; read password; stty echo`.
Linux Tips & Tricks | © ngelinux.com | 6/10/2026
