Contents

Nowadays, I have two development environments, an Ubuntu 18.04 at work and a macOS at home, both configured in the same way to increase my productivity. I came to the conclusion that typing fewer commands and having visual feedback helps you achieve your goals more efficiently and quickly.

Terminal Vanilla Bash
That was my terminal at the beginning
Terminal ZSH
Current terminal, with auto suggestion, auto complete and syntax highlighter

To do these incredible things, we will need to change the terminal through the following steps:

  • Install an application better than the system default
  • Install zsh, a more complete shell than bash
  • Install oh-my-zsh, a framework that improves your zsh experience
  • Add some super powers, like auto suggestions and syntax highlighter.

Let’s go?


The first thing to do, is to change the default terminal app

Ubuntu

Terminator is an excellent and lightweight app to be used in place of the standard terminal.

sudo add-apt-repository ppa:gnome-terminator/nightly-gtk3
sudo apt-get update
sudo apt-get install terminator

Mac

The iTerm can be downloaded and installed via .dmg or via Brew . I suggest you install Brew on your Mac, to make easier the installation of other apps, as well as the Ubuntu snap or apt.

brew cask install iterm2

The next step is to have a customizable shell

Oh My Zsh

Once you have a better app, it’s time to install zsh, a better tool than bash.

Zsh is a shell which can also be used as a powerful scripting language interpreter. It is similar to bash standard, but offers a wider range of configuration and customization.

Ubuntu

sudo apt-get install zsh

Mac

brew install zsh

If everything went well, now just change the shell and be happy.

chsh -s `which zsh`

Perhaps, for security reasons, your job does not allow changing the shell (case of banks and fintechs). In that case it is possible to add a exec zsh in the last line of your ~/.bashrc.


Bringing magic to your terminal

The framework Oh My Zsh is the perfect addition for customizing your brand new shell.

Via curl:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Via wget:

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Installing the plugin Syntax Highlighting

This is new for most people but it is wonderful. It’s called zsh-syntax-highlighting , inspired by the eponymous plugin by Fish (another shell). Tells you whether a command is valid before you press the Enter key.

Installing on Mac or Ubuntu

Just clone the project to oh-my-zsh’s plugins folder:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Then to activate, just include it in your list of plugins at ~/.zshrc:

plugins=([your other plugins] zsh-syntax-highlighting)

Restart zsh (opening a new tab on your terminal) and you’re done.

Installing the plugin Syntax Auto Suggestions

This plugin will suggest commands based on your history. Just like the previous one, just install and enjoy:

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

To activate, simply add it to the ~/.zshrc:

plugins=([your other plugins] zsh-autosuggestions)

Installing Z

The last thing I want to show you is Z. A script that makes navigating in the terminal much faster. You definitely want Z.

Instead of doing cd ~/Folder/DifferentFolder/project/, you can just do z proj. It’s simple as that! Keep in mind that z is not a magic script that knows where every folder on your computer is. It keeps track of your cd to directories in a file called ~/.z. Once you’ve cd’d into a directory once, you can use z to navigate to it.

And it’s already installed in Oh My Zsh, you just have to enable it:

plugins=([your other plugins] z)

The sky is the limit

The terminal is a really powerful tool. Facilitates and improves your daily life, instead of trying to avoid it, become better at using it.

Did you remember any other tools that help in the workflow?

Send me a message on twitter @guilhermesteves