Bash - (Current|Working) Directory

About

This article is about the management of the current directory in Bash.

Management

Query

Shell variable

shell variable concerning the current directory

Current: $PWD

working directory

pwd stands for “print working directory”.

echo $PWD

Old: $OLDPWD

Old working directory (“OLD-Print-Working-Directory”, previous directory you were in).

cd must have be used once.

echo $OLDPWD

Change


Powered by ComboStrap