What are some good Linux commands to make switching between different directories on the command line easier?
I often have to switch between different directories with long names, e.g.
cd foo/20100801-rev124-test2
ls
cd ../20100801-rev124-test1
ls
cd ../20100802-rev126-bar
Typically, I use tab completion, so it's something like this:
cd ../2010080Tab2Tab-rev12Tab6-Tabbar
But it's annoying because all these names are so similar, so tab completion doesn't really save much work.
What tricks do you use to minimize typing in such situations?
BTW, I do use pushd
and popd
sometimes, but here it won't help much because I don't visit the directories in a given order.
UPDATE:
For a nice solution, see the accepted answer to my other, related question. Basically, just create an alternative cd
command:
function cd2 { select a in $1*; do cd $a; break; done }
It will list all possible completions at once:
$ cd2 2010080
(1) 20100801-rev124-test2
(2) 20100801-rev124-test1
(3) 20100802-rev126-bar
and you can pick one by typing its number.
alias rotd='pushd -0'
then userotd
to rotate directory stack.