15

Is there a way to hide what I'm typing in a shell, so the terminal doesn't echo my keystrokes, while still keeping the output of the command?

For example, if I run ip addr show, the only thing on the screen should be the output from that command -- not the "ip addr show" that I typed.

4
  • 1
    Hi. Can you be bit more specific about, content? Jan 8, 2012 at 16:01
  • 1
    Do you mean hiding the standard input like when typing the password on login? Are you using bash? Provide some more information please.
    – user13742
    Jan 8, 2012 at 16:08
  • content means commands, for example if i type an command "ip addr show" it must be not visible in the bash terminal what i am typing . But it can i view the output of it
    – Mughil
    Jan 8, 2012 at 16:41
  • 3
    That's a weird requirement. What are you trying to achieve? Note that with typical shells, the command will also be entered in the history and saved to disk. Jan 8, 2012 at 17:04

1 Answer 1

29

If you want to disable echo of the commands you type, try this:

stty -echo

You can re-enable echo using this command:

stty echo

Note that the output of commands will show up in a somewhat different way, see this example session:

$ pwd
/tmp
$ stty -echo
$ /tmp

This resulted from typing pwd, return, stty -echo, return, pwd, return.

1
  • 3
    Note that this may or may not work depending on your shell, and perhaps on what oddities you put in your prompt. Also the setting applies to everything in that terminal; if you run a full-screen command it's likely to reset to stty +echo. Jan 8, 2012 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .