~
represents your home directory. If you are logged in as root, this will typically be /root
if you are logged in with another user (say with username user
) this will typically be /home/user
. The best way to know for certain though is either run echo ~
which will print where ~
points to, or you can run the pwd
command while in ~
which will show your present working directory - this command is generally useful to know when navigating.
What directory is the default bash directory
Question
I am using the bash console for Ubuntu and my console location is
user@MyServer:~$
If user@MyServer:/$
is the root directory, what is user@MyServer:~$
?
Solution
OTHER TIPS
As noted in other replies, it's your home directory, which is shortened to ~
.
You can find out what directory you're in using the pwd
command. eg:
[atticus:pgl]:~ $ pwd
/home/pgl
“user@MyServer:~$” is the command prompt. You can echo $PS1 to see the setting of your environment.
Its your home directory you can go to your home directory by cd ~
Not always, you can list all users' home directory by:
cut -d : -f1,6 /etc/passwd
so you will get different paths, some under /export/home/USERNAME, some under /home/USERNAME, some has no home directory. For root account, normal / is its home directly.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow