Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does 'cd -' stand for?

Tags:

linux

bash

shell

In a bash shell script today I noticed the below command at the end of the script. I know what is cd but I am unaware of the significance of a dash after it.

cd - 

What does this mean? Google naively truncates the - so I am unable to find its answer.

like image 376
AppleGrew Avatar asked Mar 16 '12 15:03

AppleGrew


People also ask

What does the CD stand for?

compact disc (CD)

What does CD stand for in business?

A certificate of deposit (CD) is a savings product that earns interest on a lump sum for a fixed period of time.

What does CD mean in time?

CD stands for Calendar Day.


1 Answers

If a single dash is specified as the argument, it will be replaced by the value of OLDPWD.

The OLDPWD is set by cd command and it is the previous working directory.

like image 131
Sandro Munda Avatar answered Sep 28 '22 12:09

Sandro Munda