How I bling-ified my terminal
Tags: beginners, learning, showdev
Published: 2018-03-20 16:04:31

---
title: How I bling-ified my terminal
published: true
tags: beginners,learning,showdev
canonical_url: 
---
<img src="https://thepracticaldev.s3.amazonaws.com/i/1wfjklunj5gwf19qi1vn.jpg">
 

> Do not be afraid of the terminal, it’s amazing!  
> – said no beginner ever.

First and foremost, this isn’t going to make you a better developer, but it’s an awesome quick and easy facelift you can do to instantly make your time in the console time pleasing to the eye and a and make you _feel_ like as if you are developer level 2000. At the very least, you’ll get some more utility and conveniences out of this (for those of you, like me, who have a bad habit of forgetting to check what branch you are on before working).

_Before_<img src="https://thepracticaldev.s3.amazonaws.com/i/wzgjxjmfkdctk5u7bd17.png">
_After_<img src="https://thepracticaldev.s3.amazonaws.com/i/i3efv77855ooh0pxgf28.png">

As I spend more time developing, I find myself staring into my console more and more. I would like to say that I’m pretty comfortable with it now and really enjoy moving files and directories and quickly making new directory and file structures compared to the repeated  right click  \>\> new blah-blah.

A lot of you veterans have already heard of different shells, so this is for the beginners out there.

### What is a shell and what does it do?

For Mac and Linux distrubutions, the most common default shell provided is `Bash`. For those of you with Windows, it’s likely you are using `PowerShell`. `Bash` is a great shell that offers things like command and file name completion, advanced scripting features, a command history, configurable colors, command aliases, etc.

Another newer, yet very similar shell, `Z shell` or `Zsh` is what we’re going to talk about today. To read in detail about the difference between bash and zsh: [Zsh vs Bash](http://stackabuse.com/zsh-vs-bash/). Because I don’t really plan on writing scripts for other developers to use just yet, it’s safe me to switch of to zsh, however, it’s quite easy to switch between the two in the active terminal with:

```
\> exec bash or $ exec zsh
```

In all honestly, I just wanted zsh for some of the convenience items like more relevant autocompletion, (try typing `git &lt;tab&gt;` with zsh) themes, plugins, and syntax-highlighting aka colorization because, like all design-minded developers out there, stuff has to look pretty and work well if I’m using it daily. I am sure the real power of zsh will become even more clearer to me as I advance.

For more details, there’s a great article here: [What’s the Difference Between Bash, Zsh, and Other Linux Shells?](https://www.howtogeek.com/68563/htg-explains-what-are-the-differences-between-linux-shells/)

### Customizing

The basic terminal is pretty bland, but when you replace the default Terminal app with something like [iTerm2](https://www.iterm2.com/), you already off to a great start in manipulating the shell environment such as how many lines to keep in memory, or colorization of the text.

But with zsh, you can get so much more fun stuff, and it’s really easy to manage. Here’s how I did it:

### TL;DR Z shell installation and customization

These steps are on Mac; just refer to the main zsh repo for instructions on other platforms like Linux and Windows. Normally zsh is included on Mac distributions, you just have to check the version. The links to the repos are at the end of this article.

#### Install zsh

_Check if zsh is already pre-installed on your machine_  
_You’ll want v5.1.1 or more recent_

In your terminal:

```
zsh --version
```

You should set zsh as your default shell.  
Run `echo $SHELL` from a new terminal to confirm.  
Expected result: `usr/bin/zsh` or similar

If not, here are the directions to install zsh: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)

On Mac OSX, you can open the User and Groups panel and go to the advanced options for your user and set the login shell to something like `usr/bin/zsh`.

#### Insall oh-my-zsh

oh-my-zsh is just a framework for managing your zsh configuration, but it’s a really awesome framework that makes managing it really easy, it’s worth it. _Get it_.

The repo provides 2 ways to get it using curl and wget, check with the repo for the latest:[Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh/). There’s really great documentation on how it all works and where everything goes.

- via curl or wget

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

#### the .zshrc

This is the equivalent to the .bash\_profile for bash shell, only a lot more helpful and comes with instructions on how to override the default settings. I just copied over my aliases from my `.bash_profile`, but you could essentially export it through the `.zshrc` or some like to just create a `.profile` that both bash and zsh can reference. Your call. But this file is awesome for aliases, which allows you to type shortcuts to frequently used directories or even remote repos, etc.

You can open this file with vim, vs code, atom, or just the plan text note pad.  
`∆ code ~/.zshrc`

That’s it you are done, just find a theme you like, if it’s a pre-packaged one, you just change the name in the `ZSH_THEME="nameOfTheme"`.

If you want to download a custom one or one that’s not pre-loaded, you just have to download it and place it in the `custom/themes` directory and then change the name and `oh-my-zsh` will find it for you.

Same with plugins, it comes with everything, you just have to activate it by adding their name to the `plugins=()` line. At the very lease you’ll want the `git` one.

Another favorite non-.zshrc prepackaged plugin is syntax-highlighter which tells you whether the command you are entering is correct. [GitHub – zsh-users/zsh-syntax-highlighting: Fish shell like syntax highlighting for Zsh.](https://github.com/zsh-users/zsh-syntax-highlighting)

![](https://i0.wp.com/www.chiangs.ninja/blog/wp-content/uploads/2018/03/Screen-Shot-2018-03-15-at-21.26.47.png?resize=277%2C372&ssl=1)

Just follow the directions on downloading and install and don’t forget to add it to the .zshrc file like this: `source $ZSH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`

Don’t forget to `∆ source ~/.zshrc` every time you make a change to this file.

#### Text editor integration

Of course, I also want to add it to my favorite text editor, VS Code!

In the settings file, type in `shell` and scroll to the bottom where you’ll see the paths set for the shell to be used by the integrated terminal: `"terminal.integrated.shell.osx": "/usr/local/bin/zsh"`

If it still says bash, then change it to zsh. Restart your VS Code and open the integrated terminal and it should say .zsh in the upper right of the terminal window.

At this point I observed an odd behavior where bash and zsh were visibly flipping back and forth several time, if the terminal is starting up slow for, double check your .zshrc profile and your `$PATH`. I had several duplicate path shims, so I had to just clear those out and now the terminal starts up instantly.

#### There are some really cool themes out there like any of the powerline versions, but I prefer to keep it simple. Throw up your terminal in the comments below and tell us what you are using!

**_links to repos and install instructions_**  
[Zsh](http://www.zsh.org/)  
[Oh My Zsh](http://ohmyz.sh/)