pushd and popd

April 25, 2008

It's amazing how one can keep on learning new bash tricks year after year. Today's candy is a pair of bash builtins: pushd and popd. pushd pushes a path on a stack, and popd pops the latest stacked path from the stack and does a cd to it.

Extremly useful!

Still, writing "pushd `pwd`" each time I want to save my location is a bit too much work, so I added 2 aliases to my bash config:

alias po='popd'
alias pu='pushd `pwd`'

Example:

[HEAD] ~/test/Module> !301$ pu
~/test/Module ~/test/Module
[HEAD] ~/test/Module> !302$ cd
[HEAD] ~> !303$ po
~/test/Module
[HEAD] ~/test/Module> !304$


Comments

RSS feed for comments on this post.

The URI to TrackBack this entry is: http://lemonnier.se/erwan/blog/bblog/trackback.php/41/

Leave a Comment

Sorry, Comments have been disabled for this post