Master `stty` for Terminal Echo Control
Quick Tip
Master `stty` for Terminal Echo Control
Challenge: Sometimes, when working with scripts that involve reading sensitive information or when dealing with specific terminal behaviors, you might want to temporarily disable the echoing of characters typed into the terminal. This can be useful for security or for custom input handling.
The Solution: Use the `stty` command to control terminal settings, specifically `stty -echo` to disable echoing and `stty echo` to re-enable it.
# Disable echoing stty -echo # Type sensitive input (e.g., password) - it won't be displayed # Re-enable echoing stty echo
Why it works: `stty` is a utility that allows you to change and print terminal line settings. The `echo` setting controls whether characters typed by the user are displayed on the screen.
Pro-Tip: You can also use `stty -icanon` to disable canonical mode, which means input is read character by character rather than line by line, often used in conjunction with disabling echo for interactive input processing.
Linux Tips & Tricks | © ngelinux.com | 5/5/2026
