Taming Terminal Echo: Control Input Display with `stty`
Quick Tip
Taming Terminal Echo: Control Input Display with `stty`
Challenge: Sometimes, when scripting or dealing with sensitive input, you might want to temporarily disable the echoing of characters typed into the terminal. This can be useful for security reasons or to prevent visual clutter in certain automated processes.
The Solution: The `stty` command is your friend here. You can use it to manipulate terminal settings, including disabling echo.
stty -echo; read -p "Enter sensitive data: "; echo; stty echo
Why it works: The `stty -echo` command disables the echoing of characters to the terminal. The `read` command then reads input without it being displayed. Finally, `stty echo` re-enables echoing so subsequent input is visible again.
Pro-Tip: You can also use `stty -echo -icanon` to disable both echoing and line buffering for more advanced, character-by-character input processing. Remember to re-enable them afterwards!
Linux Tips & Tricks | © ngelinux.com | 6/11/2026
