Working on Linux systems means that one is using the command line more often than not. Having to type long directory names over and over as well as\u00a0guessing command<\/strong>\u00a0names eats up valuable time. This can add up very quickly.\u00a0Z<\/strong>\u00a0is a tool that records every directory you browse and compiles a weighted list of the most\u00a0frequent\/recently<\/strong>\u00a0used ones.\u00a0Zsh<\/strong>\u00a0is an alternative to bash (the default shell that come with most Linux distros) that adds subtle improvements like spelling correction of words\/commands and better tab-completion.<\/p>\n Spin-up for AKLWEB Host Server or VPS<\/strong>\u00a0with running Ubuntu\u00a0(either version 12,14 or 16)<\/strong>\u00a0and follow the steps below to add a\u00a0new admin (sudo) user<\/strong>. We’re doing this because it is along the lines of\u00a0best practices<\/strong>\u00a0to create a new user and assign it admin rights to access the server, rather than use the root user.<\/p>\n You should be in your home directory after you logon as\u00a0“newuser”<\/strong>\u00a0(otherwise, run\u00a0 To test how Z works, browse to these directories:<\/strong><\/p>\n Now, from your terminal, type in\u00a0 If you are\u00a0greeted with a Zsh shell configuration prompt<\/strong>, select\u00a0“2”<\/strong>\u00a0to accept default settings.<\/p>\n To test things out, type\u00a0 Zsh also shares your terminal history<\/strong>\u00a0across multiple windows\/sessions, and has tons of other useful features. There are also\u00a0frameworks built on top of Zsh<\/strong>\u00a0that even add more dazzling features to it, such as\u00a0oh-my-zsh<\/span><\/a><\/strong>\u00a0and\u00a0prezto<\/span><\/a><\/strong>.<\/p>\n Note:\u00a0If you do not like the default settings, you can update the Zsh shell configuration by editing the\u00a0Setup & Installation<\/strong><\/h2>\n
\n
ssh\u00a0root@[akl-web-host-server-ip-address]<\/code>.<\/li>\n
adduser <newuser><\/code>\u00a0(you will need to answer some prompt questions after issuing this command).<\/li>\n
adduser <newuser> sudo<\/code>.<\/li>\n
exit<\/code>.<\/li>\n
ssh <newuser>@[akl-web-host-server-ip-address]<\/code>.<\/li>\n<\/ol>\n
Installing and Using Z<\/strong><\/h3>\n
cd ~<\/code>). Follow the next set of\u00a0steps to install Z<\/strong>. Note that\u00a0since Z<\/strong>\u00a0is a script, what we do is download it to our home directory and tell our default shell to run Z anytime it starts.<\/p>\n
\n
wget https:\/\/raw.githubusercontent.com\/rupa\/z\/master\/z.sh<\/code>.<\/li>\n
printf \"\\n\\n#initialize Z (https:\/\/github.com\/rupa\/z) \\n. ~\/z.sh \\n\\n\" >> .bashrc<\/code>.\u00a0This command appends<\/strong>\u00a0
. ~\/z.sh<\/code>\u00a0to your\u00a0
.bashrc<\/code>\u00a0file, which in turn tells it to run Z upon start-up.<\/li>\n
source ~\/.bashrc<\/code>.<\/li>\n<\/ol>\n
cd \/etc\/systemd\/system\r\ncd \/usr\/share\/nano\r\ncd \/etc\/kernel\/postinst.d\r\ncd ~\r\n<\/code><\/pre>\n
z sys<\/code>\u00a0and\u00a0push the tab button<\/strong>, then enter. Next, type\u00a0
z nano<\/code>\u00a0and hit the tab button, then enter again. You will see in both cases that Z automatically knew to\u00a0
cd<\/code>\u00a0into the first and\u00a0second directories<\/strong>\u00a0where we initially browsed.<\/p>\n
Installing and Using Zsh<\/strong><\/h3>\n
\n
sudo apt-get update && sudo apt-get -y install zsh<\/code>.<\/li>\n
zsh --version<\/code>.<\/li>\n
chsh -s \/bin\/zsh<\/code>. You will be prompted to enter your password.<\/li>\n
exit<\/code>.<\/li>\n
ssh <newuser>@[akl-web-host-server-ip-address]<\/code>.<\/li>\n<\/ol>\n
cd \/emc<\/code>\u00a0and push the tab button.\u00a0Zsh will auto-complete terminal<\/strong>\u00a0to\u00a0
cd \/etc<\/code>\u00a0because a\u00a0
\/emc<\/code>\u00a0directory does not exist and\u00a0
\/etc<\/code>\u00a0is the closest option as to what was intended. Next, type “
kill<\/code>\u00a0” and push the tab button (there is a space after\u00a0
kill<\/code>). Zsh will automatically show you a list or processes to kill as oppose to doing nothing.<\/p>\n
Using Z with Zsh<\/strong><\/h3>\n
\n
printf \"\\n\\n#initialize Z (https:\/\/github.com\/rupa\/z) \\n. ~\/z.sh \\n\\n\" >> .zshrc<\/code>.\u00a0This command appends<\/strong>\u00a0
. ~\/z.sh<\/code>\u00a0to\u00a0
.zshrc<\/code>\u00a0file, which tells it to run Z on start-up.<\/li>\n
source ~\/.zshrc<\/code>.<\/li>\n<\/ol>\n
.zshrc<\/code>\u00a0file (in your home directory), or by running the following commands:<\/p>\n
autoload -U zsh-newuser-install\r\nzsh-newuser-install -f\r\n<\/code><\/pre>\n
Conclusion<\/strong><\/h2>\n