Taming Terminal Echo with `stty`
Quick Tip
Taming Terminal Echo with `stty`
Challenge: Sometimes, when typing commands or scripts, you want to temporarily disable the echo of characters to the terminal. This can be useful for security reasons (e.g., masking password input) or for cleaner script output.
The Solution: Use the stty command to control terminal settings, specifically to toggle echo.
stty -echo
Why it works: The stty -echo command disables the local echo of characters typed on the terminal. To re-enable it, use stty echo.
Pro-Tip: You can combine this with shell scripting to prompt for sensitive input without displaying it, for example: read -p "Enter password: " && stty -echo; read password; stty echo; echo "Password entered."
Linux Tips & Tricks | © ngelinux.com | 5/30/2026
