Change Directory with two dots (cd..)

Francisco Borges f.borges at rug.nl
Wed Apr 26 13:44:37 UTC 2006


ยป On Wed, Apr 26, 2006 at 02:17PM +0100, Tony Arnold wrote:

> If you want to keep track of where you are visiting, then pushd and popd
> can be quite useful (they maintain a first in/last out queue, i.e., a
> stack; of visited directories). Problem I have is that I have usually
> cd'd to my new directory and only later wished I'd used pushd instead!

I don't know about bash, but in zsh you can get this done automatically.

setopt auto_pushd



# To get it working into full power... do this as well:

# load completion:
autoload -U compinit
compinit -D -C

# set up dirstack
setopt auto_pushd # automatically insert dirs into stack ;-)
setopt pushd_ignore_dups
setopt pushd_minus
export DIRSTACKSIZE=20

# then you can get completion on the directory stack ;-)

% cd -[TAB]
directory stack
1 -- /mnt/ipod/home/eng
2 -- /mnt/ipod/home/eng/eng
3 -- /mnt/ipod/home/eng/pop


-- 
Francisco





More information about the ubuntu-users mailing list