Question: How to hide commands typed in a Linux terminal? How to make passwords invisible while they are typed in Linux terminal?
The “stty” command can come handy here. The “echo (-echo)” option can be used to echo or not echo commands typed in the terminal. From the man page of stty command:
# man stty echo (-echo) Echo back (do not echo back) every character typed.
“echo” echoes characters as they are typed (full-duplex operation). If a terminal is half-duplex and displays two characters for each one it should display, turn the echo parameter off (–echo). Use –echo when the user is entering passwords.
Enable or Disable echo of Keys/commands on Linux terminal
To disable echo of the commands you type on the shell/terminal, execute the below command:
# stty -echo
To enable echo of the commands you type on the shell/terminal, execute the below command:
# stty echo