pushd / popd

Started by Metgod, January 29, 2003, 02:45:23 PM

Previous topic - Next topic
I actually first learned of this from Brian Martin's attrition, and then I realized it was also in Win2k's version of 'dos'.

If you know how the stack works, you have it made. It's all about changing directories here.

Example:

% pwd
/usr/home/metgod
% pushd /etc
% pwd
/etc
% popd
% pwd
/usr/home/metgod

Basically, if you are working in one directory, and need to do something else but making it easier to go back, you can use pushd [new dir] and then popd will take you back to the original one.

pretty useful and neat.

Met
"My Terminal is my Soul"

That is a real good tip to give Metty. This tip is especially useful when going back and forth between two directories such as when working on a website and making changes to html and maybe a config file somewhere else and you have to keep going back and forth between the two.

Good job Met!
*** Sleep: A completely inadequate substitute for caffeine. ***
01010010010101000100011001001101

Thanks. :)

Well there are other ways to go back and forth but this has to be the easiest. There is always setting a variable and just cd'ing to it, but why when you have this ?

Bad thing is that not all shells have pushd / popd. For example, ksh does not have it. I actually like KSH but I am slowly finding that CSH does indeed have things that are very useful. :)

That reminds me though, I have another tip to post :)


Met
"My Terminal is my Soul"

another cool tip:

switch to zsh, type in a command and hit the tab...it will give you a list of commands in your path that you can use...keep hitting that tab to scroll through them...

I think that is pretty handy..

Wilnix
alt email address: wilnix@hackphreak.org

SMF spam blocked by CleanTalk