Skip to content

Read a Password Without Echoing It

Prompt for a password with read -s so the characters never appear on the terminal, then restore the cursor to a new line.

Language: Shell

Added on: 19th August 2026

printf 'Password: '
read -rs password
printf '\n'

Caveats

Leaves the value in password. Do not echo it or pass it on a command line. Needs bash read -s.