Ditch Your Boring Terminal and Make it More Useful

mohammadfaisal

Mohammad Faisal

Posted on May 11, 2024

Ditch Your Boring Terminal and Make it More Useful

To read more articles like this, visit my blog

Expected design

Contrary to popular opinion, programmers are human. We like nice things. And the terminal is one of the most important things that we use on a day-to-day basis.

So why live with a boring terminal when you can make it colourful and fun?

Today, we will do precisely that. Let’s begin!

Install Homebrew

If you are using a mac, you are most probably already familiar with homebrew. It helps with installing software on macOS.

Run the following command:

/bin/bash -c "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh](https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh))"
Enter fullscreen mode Exit fullscreen mode

You may need to install the CLI tools for XCode before that:

xcode-select —-install
Enter fullscreen mode Exit fullscreen mode

If you get an error, run the following command to reset:

xcode-select -r
Enter fullscreen mode Exit fullscreen mode

And that’s it!

2. Install Iterm2

Iterm2 is a terminal emulator for macOS. It’s kind of a replacement for your original terminal. It comes with a bunch of cool features and customizations that we will go over later

Run the following command:

brew cask install iterm2
Enter fullscreen mode Exit fullscreen mode

3. Install ZSH

ZSH, also called the Z shell, is an extended version of the Bourne Shell (sh). it has some advanced features like

  • Automatic cd: Just type the name of the directory.

  • Plugin and theme support: ZSH has many plugin and theme frameworks to boost up your terminal even more.

To install it run the following command:

brew install zsh
Enter fullscreen mode Exit fullscreen mode

And you should be set up.

4. Install Oh My ZSH

According to their website

Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration

In short, it will help you to manage the configuration and customizations for your Z Shell.

To install, run the following command:

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

Okay, now, you have the basic setup complete.

You should already have a nice-looking terminal than before.

5. Customize the Theme

Now restart your iTerm2 and type the following command:

open .zshrc
Enter fullscreen mode Exit fullscreen mode

it will open the config file with a text editor. You can also use nano if you like.

Now there will be a variable named ZSH_THEME . And the value there is robbyrussell . If we set it to random, then every time we open our terminal, a new theme will be loaded

ZSH THEME

However, you can choose from a wide variety of themes here.

Let’s use a popular custom theme named powerlevel10k. First, install it.

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Enter fullscreen mode Exit fullscreen mode

Then set the theme name:

ZSH_THEME="powerlevel10k/powerlevel10k"
Enter fullscreen mode Exit fullscreen mode

Then save the file and run the following command from the terminal:

exec zsh
Enter fullscreen mode Exit fullscreen mode

Then open iterm2 again and configure the terminal by running the following command:

p10k configure
Enter fullscreen mode Exit fullscreen mode

It will take you through the configuration process and at the end of it, you will have a nice-looking terminal!

Colorful Terminal

6. Customize with Plugins

Plugins are what make the zsh so powerful and fun to use. There are a lot of plugins that you can find here. Let’s try one of them!

Do you like typing? I guess not. We can have some autosuggestion inside our terminal by using a plugin named zsh-autosuggestions.

Run the following command.

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode

Then open up your .zshrc file. And find the plugins section. You will see there is already a plugin there (git). Add our new plugin.

ADD A NEW PLUGIN

That’s it. Now when you want to type a command the terminal will give you suggestions!

Auto Suggestions

Final Thoughts

There are a lot of things that you can do with oh my zsh . I have shown the absolute basics here. I hope you enjoyed it.

Have a great day!

Resources:

Have something to say? Get in touch with me via LinkedIn or Personal Website

💖 💪 🙅 🚩
mohammadfaisal
Mohammad Faisal

Posted on May 11, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related