Terminal Setup for the impatient

Terminal Setup for the impatient

Setting up a terminal from scratch with zsh and alacritty for a convenient development workflow


4 min read

Setting up a modern terminal workflow can be daunting, but at the same time quite rewarding and helpful once you get the hang of it. In this post, I'll share the steps I usually follow to set up a new terminal, and the settings and plugins I use that feel useful 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. During 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,

Installing 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.

Installing 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.

Installing 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 cleaner!

Installing Alacritty

Most Unix-based distros come with their flavor of the terminal emulator app, i.e. Terminal in macOS, gnome-terminal in Ubuntu, Terminator in Manjaro, and so on. I've been using Alacritty for a while now, it's a "blazingly fast" terminal emulator app written in Rust with tons of customization options. Let's set it up.

mkdir -p ~/.config/alacritty
  • Create an alacritty.yml config file inside the alacritty folder with the following content. The location should be $HOME/.config/alacritty/alacritty.yml. This is a minimal version, the full list of configs can be found in their repository.
# makes config change effects instant
live_config_reload: true
# styles for the window
    columns: 120
    lines: 36
  opacity: 0.98
    x: 12
    y: 10
  dynamic_padding: false
  decoration: none
  decorations_theme_variant: Dark
# font setup for the terminal
# use Nerd font for better unicode support.
# https://www.nerdfonts.com/font-downloads
    family: "MesloLGS NF"
    style: Regular
  size: 12
# cursor styles
    shape: Beam
    blinking: On
# some utilites
save_to_clipboard: true
draw_bold_text_with_bright_colors: true
  • Install a theme of your choice following the instructions in the alacritty-theme repo. The one in the screenshot below is the dracula theme.

  • Bonus Tip for Ubuntu Gnome: In Ubuntu gnome (the default Ubuntu variant), Ctrl + Alt + T opens the default terminal. If you want to change the default terminal to Alacritty,

  • Go to Settings > Keyboard > View and Customize Shortcuts and search for Terminal. There should be an entry under Launchers, named Launch Terminal. Click on it, and press backspace. This will disable this shortcut and the Ctrl + Alt + T the combination is now free to use for custom shortcuts.

  • At the end of the previous shortcut list, there's an option named Custom Shortcuts. Click on it, and on the next page, click the + icon. This will show a prompt for a new keyboard shortcut, fill in the name as you like and use the cleared shortcut combination. The command value here is alacritty.

With these configs in place, start a new session of alacritty, the terminal should look something like this ๐Ÿ‘‡

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