Maximizing use of the terminal

Albin Groen
May 11 · 6 min read

If you are a developer or engineer you have probably touched the terminal or a command line of some sort before. There is a reason why so many think the command line is so much more powerful than using a graphical user interface. If you are comfortable with it you can navigate around your operating system and computer much faster and get much more done in less time. Especially if you work with software development, using the terminal can greatly improve your productivity and workflow. Getting comfortable with the terminal can take quite some time. But it is certainly worth it. Rome was not built overnight after all — or however, it goes.

Investing time into your tools as a software developer is something that will gradually improve your workflow and enjoyment of doing work you previously may not have prioritized. Setting up a perfect development environment is a long process. Here are some tips and tricks to get your boring old terminal interesting and more enjoyable to work with every day. Some of these tips you may already know of— but hopefully, you will find some of it useful.

1. Terminal & shell

The shell is the engine of your terminal. The default shell on most machines is called Bash (The Born Again Shell). Although Bash works perfectly fine, many are switching to other UNIX shells like Zsh, Fish, and Rc, since these are much more customizable. This article will be aimed at terminals running with Zsh, but the majority of the tips will also work for other shells. The default terminal on your computer is most likely not very customizable and therefore I, as well as many other developers, recommend a terminal like iTerm if you are on Mac. iTerm comes with many amazing features and is extremely configurable.

Installing iTerm2 & ZSH

If you want to read the full documentation on installing ZSH I highly recommend visiting the official Github repository:

iTerm2

https://www.iterm2.com

ZSH

$ brew install zsh zsh-completions

Set ZSH as your default terminal shell by entering the following command inside of a terminal window:

$ chsh -s /bin/zsh

Now, after installing and opening iTerm2 you should be greeted with something like this.

2. Sessions, windows, and pane-management

After getting set up with a new terminal and terminal shell engine we want to install a tool called Tmux. Tmux is a great terminal multiplexer tool for managing multiple sessions and activities at once, using multiple windows, and splitting your window into multiple panes however you want. Tmux event lets you shut down your terminal and still let processes and activities run in the background while you work on something else.

Installing Tmux

Assuming you have Homebrew installed on your machine, installing Tmux is as easy as running the following command

$ brew install tmux

Now, to start a new Tmux session just type the following:

$ tmux

Now with Tmux up and running we can easily split panes as we want, create multiple sessions, switch between tabs, add windows and much more.

Read more about Tmux here:

3. Themes & Fonts

The most fun part with setting up your computers’ terminal and terminal-shell include styling it the way you want to. Luckily iTerm2 and Zsh are very customizable and easy to theme and configure as you want to. For this article, we will install a theme for iTerm2 called Lovlace and also enable a popular Zsh theme called Agnoster .

iTerm2 lovelace theme

Zsh Agnoster

The great part of installing themes for Zsh is it is a really easy process. All you have to do is go ahead and choose a theme, open the configuration file, and input the theme you want to use. Like the following:

$ nano ~/.zshrc

And changed to the following ZSH_THEME=”agnoster”

Close nano by hitting ctrl+x and save by hitting y. After this, you will have to refresh your Zsh configuration by entering the following command into a terminal window.

$ source ~/.zshrc

You now have successfully enabled the Agnoster theme for Zsh!

4. Plugins

Zsh is, as mentioned, very customizable and allows for many add-ons and plugins. Some of my favorite plugins allow for auto-suggestions when typing commands, syntax highlighting for easier realizing mistakes when typing in the terminal, as well as the git plugin for Zsh. Installing Zsh-plugins is really easy. All you have to do is download the plugin you want to install, place it inside of Zsh’s plugins folder and then add it in the configuration file. Or if you are running Zsh with Oh-My-Zsh, which we are doing, all you have to do is clone a git repo with the plugin and add it to our configuration file.

Zsh-autosuggestions

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

Then go ahead and add into your Zsh configuration file inside of the plugins section. Here, you add all of the plugins you want to install. Many plugins are already located inside of the plugins map and you can just enable them by adding them to the plugins section.

Zsh-syntax-highlighting

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

Now just follow the previous process by adding the plugin inside of the plugins section in your configuration file. While you are already inside of the configuration file I highly recommend adding the git plugin which allows you to enter git commands with loads of shorthands for improved speed and productivity.


At this point, you will have a very intuitive terminal to work with every day, instead of clicking around user interfaces. This, at least for me, increased productivity and workflow substantially as I felt so comfortable with the command line after using it for a couple of months. Being able to have multiple sessions at once, split panes to have a server running on one side and a text-editor like Nano or Vim on the other side is very freeing. And remember, what works best for you, are always the best tools.

Albin Groen

Written by

Hi! I’m Albin, a front-end developer from Sweden passionate about software development, design, and self-improvement.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade