Mistake in files-directories-commands about "~"
Bug #570423 reported by
Leo Iannacone
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-docs (Ubuntu) |
Fix Released
|
Medium
|
Connor Imes | ||
Bug Description
Binary package hint: ubuntu-docs
In files-directori
The ~ character represents the current user's home directory. As seen above, cd ~ is equivalent to cd /home/username/. However, when running a command as root (using sudo, for example), ~ points instead to /root. When running a command with sudo, the full path to your home directory must be given.
Is not fully true, in fact if you run:
sudo echo ~
You'll see:
/home/username
To post a comment you must log in.
Leo, thank you for your report. I see what you are saying, though it is not entirely accurate. In a basic sudo environment, your user's environment variables remain intact, so ~ still references your home directory. If you entered a sudo-root shell with "sudo -s", you will find that "echo ~" prints your home directory. However, if you use the initial-login switch, "sudo -i", running "echo ~" will print "/root".
I think this note in the docs needs to be removed altogether since it is inaccurate and not really applicable to this specific section of the docs anyway.