Amit Biswas
Amit's Blog

Follow

Amit's Blog

Follow
Part One: Setting up Zsh

Photo by Gabriel Heinzer on Unsplash

Part One: Setting up Zsh

Amit Biswas's photo
Amit Biswas
·Mar 19, 2023·

3 min read

Setting up a modern terminal workflow can be daunting, but quite rewarding and helpful once you get the hang of it! In this series, Terminal setup for the impatient, I'll share the steps I usually follow to set up a new terminal, and the settings and plugins I use that feel fast and manageable to me. Let's dive in!

  • Installing zsh: The first step to a good terminal experience is to ditch bash and install zsh! Zsh is available to install in most of the Linux distro repositories and is the default shell for recent macOS versions. To install and set as default in Ubuntu, run,

      sudo apt install zsh && \
      chsh -s $(which zsh)
    

    You can check the current shell with echo $0. For in-depth instructions to install zsh, refer to the link here. After the installation and setup are done, log out and log back in to apply the new shell changes. In the first initialization, a prompt will ask if we want to create a .zshrc. Enter 2 to populate the .zshrc automatically. The shell will look like this,

  • Install Oh-My-Zsh: Oh My Zsh is an open-source framework for managing your zsh configuration. Make sure you have git, curl, and of course, zsh properly installed beforehand, and then run this simple command,

      sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    

    As we can see in the following screenshot, the shell already changed after installing OMZ.

  • Install Plugins: zsh has hundreds of useful plugins, serving various user needs. I use only three, and they've proven to be quite handy in my experience.

    • git is installed by default and has tons of shortcuts for daily git actions. Plugin details can be found in the source file.

    • zsh-autosuggestions is the OG! It suggests commands as you type based on history and completions. Sounds simple, but the experience of using this plugin is so good! It can be installed from their official repository using oh-my-zsh.

    • zsh-syntax-highlighting is the OG brother of the aforementioned OG! It enables the highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal. It can be installed from their official repository using oh-my-zsh.

  • Install a shell prompt: A good shell prompt is not only essential for an aesthetic look, but also for usability purposes. Apps like Starship do this quite nicely, but I use Powerlevel10k just because! It has a great configuration wizard, supports many utilities out of the box, is arguably much faster than its competitors, and lastly, is easy to install. Installation instructions along with the recommended font support can be found on their official repository. My personal config is a bit minimal and doesn't use many fancy icons and features, it's a bit clean!

Phew! Lots of installing and searching and whatnot! But if everything went correctly, you should be presented with a nice-looking shell prompt, which has autocompletion, syntax highlighting, and looks not too nerdy!

That's all for setting up zsh! In the next post, we'll have a look into changing the boring terminal emulator with something new, Alacritty! Till then, Peace ✌️

 
Share this