Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
1  
Hi. Can you be bit more specific about, content? –  Nikhil Mulley Jan 8 '12 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. –  Herman Torjussen Jan 8 '12 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 '12 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. –  Gilles Jan 8 '12 at 17:04

1 Answer 1

up vote 9 down vote accepted

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.

share|improve this answer
1  
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. –  Gilles Jan 8 '12 at 17:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.