HFX Forum

Neophyte Section => Tips & Tutorials => Topic started by: Metgod on January 29, 2003, 02:45:23 PM

Title: pushd / popd
Post by: Metgod on January 29, 2003, 02:45:23 PM
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
Title: Re:pushd / popd
Post by: Uneek on February 03, 2003, 03:19:30 PM
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!
Title: Re:pushd / popd
Post by: Metgod on February 04, 2003, 11:28:03 PM
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
Title: Re:pushd / popd
Post by: wilnix on April 29, 2003, 06:58:38 PM
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