PUSHD, POPD and DIRS - manage the directory stack


Add the current directory to the directory stack.

pushd ~/tmp

Add ~/tmp directory to the stack and cd there.

dirs -v

Display the directory stack.

pushd +2

Bring the directory at the 2 position to the front of the stack (0) and cd there.


Pop off (remove from stack) the top/current directory in the stack (position 0).

popd -1

Remove the directory at the 1 position in the stack.

Or you could just use Poor man's recall:

cd -

Recalls the last directory. Just like the recall button on your TV remote.

No comments

Add your comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

Find Me Around

User login