First i did pwd, it says:
/home/user
I changed my directory using :
cd /Italic/Food/Places
Now, I want to go back to original directory: /home/user. How can I do this?
First i did pwd, it says:
/home/user
I changed my directory using :
cd /Italic/Food/Places
Now, I want to go back to original directory: /home/user. How can I do this?
To cd to the previous directory, you can use one of the following commands in bash:
cd -
cd "$OLDPWD"
To cd to your home directory, use one of:
cd
cd ~
cd "$HOME"
If you want to undo multiple cds, cd can't help you. You'll have to use the pushd and popd commands. Instead of cd foo/bar, do
pushd foo/bar
Then you can use the popd command to undo as many times as you have used pushd.
Example:
/tmp/lightdm-1.10.5 $ pushd ~
~ /tmp/lightdm-1.10.5
~ $ pushd devel
~/devel ~ /tmp/lightdm-1.10.5
~/devel $ popd
~ /tmp/lightdm-1.10.5
~ $ popd
/tmp/lightdm-1.10.5
/tmp/lightdm-1.10.5 $
Also see:
cd - returns to the previous directory.
If you want to go to home dir specifically, use cd, cd $HOME, or cd ~.
cd ~ will work. ~ is basically a shortcut for /home/user. If cd ~ takes you to the home folder, then use cd ~/user instead.