Ubuntu – What does su > echo “” mean

bashcommand linesudo

When I was entering the command

su > echo  "sachin"

it was asking for a password. When I gave my password, some strange things happened as you can see:

Enter image description here

One more thing: there is another user, Hadoop, on my laptop, but when I do

su > echo "Hadoop"

it says

no passwd entry for Hadoop

What does this mean?

Best Answer

Ah! Nice puzzle!

Just say "exit", and all your files will be there (and the output you miss in a file called echo).

Explication:

 su > echo user 

is the same as

 su user > echo

So you are starting a (sub)shell with su (switch user) to your user, with all output redirected to a file called echo!

Look:

[romano:~] % cd tmp/dvd-usa-hd 
[romano:~/tmp/dvd-usa-hd] % ls
dvd-usa-hd_01_01.avi
[romano:~/tmp/dvd-usa-hd] % su > echo romano
Password: 
[romano:~/tmp/dvd-usa-hd] % ls
[romano:~/tmp/dvd-usa-hd] % exit
[romano:~/tmp/dvd-usa-hd] % ls
dvd-usa-hd_01_01.avi  echo
[romano:~/tmp/dvd-usa-hd] % cat echo
dvd-usa-hd_01_01.avi
echo
[romano:~/tmp/dvd-usa-hd] % 
Related Question