How to go home directory using terminal

Asked by rajusenthi

How to go home directory using terminal

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

cd ~

or

cd /home/$USER

is you have used su to change to another user, you will go to that home directory

You can see what username you currently are with

whoami

Revision history for this message
Jim J (morlockhq) said :
#2

You just have to use the tilde (~) shortcut.

You can try using cd on its own, in the terminal, just type:

cd

and that should work.

However, the most explicit way is to use the tilde and it offers other benefits. So, in the terminal, type:

cd ~

and you will be taken to the home directory of the username that you are logged in under.

The nice thing about using the tilde reference is that you can change to directories relative to the user's home directory.

So, to change to the Desktop in the terminal, just type:

cd ~/Desktop

and you will be transported to /home/USERNAME/Desktop

Tab completion also works with the tilde shortcut, so you can type:

cd ~/Des <Keyboard Tab key>

and it will expand to the directory

cd ~/Desktop (if there are no other directories beginning in Des in your home directory.

Can you help with this problem?

Provide an answer of your own, or ask rajusenthi for more information if necessary.

To post a message you must log in.