[Discuss] efficiently changing directories?
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Fri Aug 3 00:46:07 PDT 2007
On 2007-08-02 21:54-0700 Daniel M German wrote:
>
> Hi everybody,
>
> as time passes by my directory structures grow bigger and bigger.
> Does anybody know of a utility or method to change directories easily?
>
> I used to use tcsh and it had a nice feature (which I have totally
> forgotten what its name was) to specify a set of directories where cd will
> try to find a directory if it did not exist in the current path.
>
> While I was writing this I found that it also exists in bash, and
> enabled it (CDPATH). I should have read this part of the man page long
> time ago!
>
> Yet, I am curious to know, are there any utilities that people use to
> quickly move to directories (other than writing aliases)?
I am sure you are already aware of pushd, but I will mention it just in case
there are others here that have not heard of it. I use "pushd +N" where N
denotes how deeply you want to retrieve from the top of pushd stack of directories
to quickly move between up to 6 different directories, but I don't think it
would work very well for larger numbers because you would start to lose
count of how deep you should go into the pushd stack of directory names to
retrieve the directory you want. To clean up the pushd stack of directories
(i.e., get rid of the ones I am no longer using) I use "popd +N". BTW, I
just looked up pushd in the bash man page and there is also a -N option to
specify from the bottom of the stack rather than the top so in fact you
could probably deal with say up to 12 directories (up to 6 levels deep from
either the top or bottom of the stack) quite easily with this command.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the Discuss
mailing list