>_ improve your style and increase your productivity on the terminal with OH MY ZSH
Tags: terminal, productivity, bash, zsh
Published: 2021-12-31 16:34:21

When I heard Mac OS has made **zsh** the default shell, then I began to wonder 🤔 ...there must be something someone isn't telling me.
![find out one day](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/foqptqsu90woceruj9io.gif) And amma find out today!

---

#Zsh Setup 
The first problem I encountered was deciding what to call it
(zssssh or z-shell🤷). After thinking a bit, I was like "fuck it!, let's get down to business".

> ######_The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh._

###Installing zsh (Z shell)
I installed zsh with this command:
```
$ sudo apt-get zsh
```
Then made zsh the _default shell_ ..with this command on the terminal:
```
chsh -s $(which zsh)
```
And after that, you will be prompted to enter your pc password.
```
password: *****
```

Now we have _**zsh installed**_ and it has been made the _**default shell**_
> _You may need to restart your computer for this to take effect._

---
###zsh configuration
Enter `zsh` on the terminal and hit enter ↵:
```
$ zsh
```
...and you will see this message.
![zsh prompt](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hp3n0a9ra8wtrmuk3eyv.png)Enter **2** to get the default configuration

Now the **zsh is up and running**. Over to "Oh My Zsh".

---

#Oh My Zsh setup

> ######_Oh My Zsh is an open source, community-driven framework for managing your zsh configuration. Sounds boring. Let's try again. Oh My Zsh will not make you a 10x developer...but you may feel like one._

Install oh-my-zsh via curl
```
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
you should see an output similar to this, while it installs:

![oh-my-zsh installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/htnfiofx16dtcazztqph.png)
**Oh My Zsh is now installed**, and we will use the `.zshrc` file for customizing the terminal


---

#Customizing Oh My Zsh
With the `.zshrc` file you can add **plugins** and change the **theme** of your terminal.
The `.zshrc` file is located at the home directory `~/.zshrc`

###Oh My Zsh Plugins
Open the `.zshrc` file and find this line:
```
plugins = (git)
```
then add web-search to it, like this:
```
plugins = (git web-search)
```
save the `.zshrc` file and return to the terminal.

Now enter `exec zsh` on the terminal:
```
$ exec zsh
```
to reload the terminal.
> _the `exec zsh` for reloading the terminal is one of the "zsh goodies"._

With the `web-search` plugin you added, you can now google for stuff from the terminal.
Like this:
```
$ google what is zsh
```
and your browser will pop-up and search for "what is zsh"

---

###Oh My Zsh Theme
Open the `.zshrc file` and find this line:
```
ZSH_THEME = "robbyrussell"
```
and then change `robbyrussel` to `agnoster`, like this:
```
ZSH_THEME = "agnoster"
```
save the `.zshrc` file and return to the terminal
Restart the shell or enter this command `exec zsh` to reload terminal.
```
$ exec zsh
```

And Voila, you have a pretty looking terminal.

![productivity tom + style girlfriend](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g6k8m2pcj4qd8s8ayu2n.jpg)


---

By default, the terminal will display something like this:
```
yourusername@yourmachinename ~/blah/blah/blah-directory
```

Here is how you get rid of the `yourmachinename` part:
- add this code at the end of the `.zshrc` file
```
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}
```
Save the file.

Then go to the terminal and enter `exec zsh` to reload:
```
$ exec zsh
```

![terminal screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp1jy3rqdljy4wi3agiu.png)

That was how Zsh became my default shell and bash was ...bashed 💥.

---

####Extra Tip: how to fix display error on vscode in-built terminal
If you open up your vscode terminal and it looks like this:

![vscode terminal display error](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzej664gi3ra6zv9vq3n.png)

Don't be scared, there is nothing to worry about, it's just some font issue.
- Go to the vscode User `settings.json` file (for Ubutu users: the settings.json file lives here: `/home/$USER/.config/Code/User/` 
- Add this command `"terminal.integrated.fontFamily": "Ubuntu Mono, Monaco, PowerlineSymbols"` to the file
```json
{
// ...other vscode settings,

"terminal.integrated.fontFamily": "Ubuntu Mono, Monaco, PowerlineSymbols",
}
```
Save the file and restart vscode.

![vscode ternimal error display solved](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tafnn7825n1kg2g8qusq.png)

And we are all good 🥂
######_Don't forget to hit the like button._ ❤️