Site icon New Generation Enterprise Linux

Tame Your Terminal Echo with `stty`

Quick Tip

Tame Your Terminal Echo with `stty`

Challenge: Sometimes, when typing passwords or sensitive information in the terminal, you might want to prevent the characters you type from being displayed on the screen for security reasons. Similarly, you might want to control other terminal input behaviors.

The Solution: The `stty` command offers fine-grained control over terminal input and output settings, including disabling echo.

stty -echo

Why it works: The `stty -echo` command tells the terminal to stop echoing characters that are typed to standard output. This is particularly useful for secure input fields. To re-enable echoing, use stty echo.

Pro-Tip: You can use stty -icanon to disable canonical mode, which means characters are sent to the program as soon as they are typed, rather than waiting for a newline. This is often used in interactive programs that need immediate character input. Remember to re-enable it with stty icanon when done.

Linux Tips & Tricks | © ngelinux.com | 6/12/2026

0 0 votes
Article Rating
Exit mobile version