Home > Shell Scripts > How to hide your shell commands

How to hide your shell commands

Have you thought of hiding what you are doing on your linux bash shell prompt? and not allowing your colleague to see what command you are entering or do you want to confuse your colleague by showing something invisible but work as visible? then read out this…

Today I came across a neat, but pointless shell command. By running the following in shell, it will hide any commands you run.

root@server2 [/]# stty -echo

In order to disable this mode, simply remove the “-” before echo.

root@server2 [/]# stty echo

I guess there really is no point to the command, though you could always mess with your coworkers if they leave their shell prompt open

Cheers.

Categories: Shell Scripts Tags: ,
  1. Paulo Matos
    May 14th, 2009 at 09:48 | #1

    Hi Kristine!

    The only use I can think about for this command is when you do an interactive shell script and you want the user to input a password.

    Cheers,

    Paulo Matos

  2. Guy
    May 14th, 2009 at 11:45 | #2

    But when you do stty echo again your command history is still going to be visible via up-arrow presumably…

  3. random
    May 14th, 2009 at 14:21 | #3

    you are just toggling the terminal echo. It is not a pointless command. one example usage is handling of passwords from the terminal…

  4. May 18th, 2009 at 19:34 | #4

    It is also useful in shells which do not have the capability to read a single character:

    get_key()
    {
    [ -t 0 ] &_KEY=`dd bs=1 count=1 2>/dev/null`
    [ -n "$1" ] && eval “$1=\”$_KEY\”"
    [ -t 0 ] && stty $_STTY
    [ -n "$_KEY" ]
    }

  5. beparas
    May 19th, 2009 at 03:56 | #5

    Hi Kristine
    It’s really great.
    :-)

  6. Finnbarr P. Murphy
    May 20th, 2009 at 11:40 | #6

    The -echo option to the stty utility was very useful in the days of serail line terminals such as the DEC VT220 and Wyse 60. Some terminals echo’ed everything via hardware, some did not.

  7. JurgyMan
    May 20th, 2009 at 13:26 | #7

    How can I make some new posts on this wonderful looking site?
    I have some stupid linux tricks to share… :-p

  1. May 13th, 2009 at 23:32 | #1
  2. April 2nd, 2010 at 12:16 | #2