How to cd back to the previous directory

In Linux & FreeBSD, often we need to cd to a directory then ls to find out the files in that directory. Then only to find out we need to go back to the previous directory and do something else, and we will need to type "cd /very/long/directory/name/and/it/is/just/so/not/cool/to/do/".

Next time, use :
cd -
and it will go back to the previous directory.

The abbreviation of home directory is

Go back to home directory of the current user :
cd ~/

Copy the text file current.txt to home directory :
cp current.txt ~/


will change the current directory to home directory.

By the way :
will display the current path, which also means Print Working Directory.

Cheerio !!!

1 comment:

Unknown said...

very useful thank u