My 2 paisas

pushd and popd commands

Posted on: December 9, 2009

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

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

I hope it is useful. Definitely very useful for me.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Links that I liked to save

Blog Stats

  • 45,386 hits
%d bloggers like this: