Suppose you are presently working some directory and for some reason you need to cd into some other directory for some trivial but urgent work. So how do you remember which directory you were in. This is where pushd and popd commands are used.
Pushd command adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. With no arguments, exchanges the top two directories and returns 0, unless the directory stack is empty.
sumit@sumit-Desktop:/var/www/cgi-bin$ pushd /usr/share/apps
/usr/share/apps /var/www/cgi-bin
sumit@sumit-Desktop:/usr/share/apps$
and popd command removes entries from the directory stack. With no arguments, removes the top directory from the stack, and performs a cd to the new top directory.
sumit@sumit-Desktop:/usr/share/apps$ popd
/var/www/cgi-bin
sumit@sumit-Desktop:/var/www/cgi-bin$
I hope it is useful. Definitely very useful for me.