Taming Terminal Echo with `stty`
Quick Tip
Taming Terminal Echo with `stty`
Challenge: Sometimes, when typing commands, especially in scripting or interactive shells, you might want to control whether the characters you type are displayed on the screen (echoed). This can be useful for security (e.g., hiding password input) or for custom terminal behavior.
The Solution: The `stty` command is your friend for controlling terminal line disciplines, including echo behavior.
# To disable terminal echo stty -echo # To re-enable terminal echo stty echo
Why it works: `stty -echo` tells the terminal driver to stop sending input characters back to the terminal for display. `stty echo` reverses this, re-enabling the display of input characters.
Pro-Tip: You can also use `stty -echo; read password; stty echo; echo “Entered: $password”` to read a password without displaying it.
Linux Tips & Tricks | © ngelinux.com | 6/3/2026
