How do I install the shell "z" script directory jumper on Ubuntu 12.10?
Put something like this in your $HOME/.bashrc or $HOME/.zshrc:
cd around for a while to build up the db.
You need to download the
z.sh file to a directory of your choosing, then tell your
.bashrc where it is, so your terminal can find it. (The same applies for z-shell, which is just another shell system.) Then, after you use bash for a while,
z will know your favorite locations.
printf "\n\n#initialize Z (https://github.com/rupa/z) \n. ~/z.sh \n\n" >> .bashrc. This command appends
. ~/z.shto your .
bashrcfile, which in turn tells it to run Z upon start-up.
- Reload shell
To test how Z works, browse to these directories:
cd /etc/systemd/system cd /usr/share/nano cd /etc/kernel/postinst.d cd ~
Now, from your terminal, type in
z sysand push the tab button, then enter. Next, type
z nanoand hit the tab button, then enter again. You will see in both cases that Z automatically knew to
cdinto the first and second directories where we initially browsed.
Using Z with Zsh
printf "\n\n#initialize Z (https://github.com/rupa/z) \n. ~/z.sh \n\n" >> .zshrc. This command appends
.zshrcfile, which tells it to run Z on start-up.
- Reload shell
Using Z with Zsh + Oh My Zsh
z to the plugins list in
plugins=( git z )
z script to your home directory:
wget https://raw.githubusercontent.com/rupa/z/master/z.sh -O ~/.z
When installing scripts like this (shell augmentation), it is usually a good idea to install them to
/etc/profile.d. To download and install in a single step, you can use the following command:
sudo curl https://raw.githubusercontent.com/rupa/z/master/z.sh \ -o /etc/profile.d/z.sh
Some of the advantages of installing your shell modifications on
- It will be available for all shells and users;
- There's no need to
- It is easier to uninstall (just remove the file);
- It is easier to remember where you put them.