the meaning of "~" (was: Terminal)
Markus Schönhaber
ubuntu-users at list-post.mks-mail.de
Fri May 15 15:15:23 UTC 2009
sg1:
> Moving from director to directory I am using cd ~/name of director the
> terminal is not recognising the "~" for some reason.'
The "~" is recognized as expected. Your expectation is wrong.
The shell expands "~" to the path to the home directory of the effective
user.
> sg1 at sg1-desktop:~$ sudo su
Now you're not sg1 any more - you're root instead.
> root at sg1-desktop:/home/sg1# cd ~/Desktop
> bash: cd: /root/Desktop: No such file or directory
The shell expands "~" to the path of the effective user, root (remember:
you're not sg1 any more), which is /root.
What you do above is the same as doing
cd /root/Desktop
literally.
> root at sg1-desktop:/home/sg1#
>
> For example trying to move from sg1 to desktop and back again, no luck
> so far.
Why do you do
sudo su
in the first place? What problem are you really trying to solve?
https://help.ubuntu.com/community/RootSudo
--
Regards
mks
More information about the ubuntu-users
mailing list