Terminal Enhancers - Part 1
7 min read
I have been thinking for a long time to write about terminal tools which help me to increase my productivity a lot. Finally yea! I have started writing. I do not want to put all these interesting tools in a single blog post so planned to write a series of blogs.
Here is my terminal setup:
In the first part, we are going to talk about the top 5 tools (my personal choice)
- Oh My ZSH!
As a developer who spends most of the time in the terminal. When I think about machine setup, the First thing that comes in my mind is Alacritty.
Its GitHub page describes as follows, so do I.
Alacritty is the fastest terminal emulator in existence. Using the GPU for rendering enables optimizations that simply aren't possible without it. Alacritty currently supports macOS, Linux, BSD, and Windows.
I was a fan of Iterm multi panes but after started using alacritty + tmux, now I barely open iTerm on my machine.
WHY Alacritty is better:
- Faster: It is written in rust with the philosophy of focusing on speed. Alacritty is one of the fastest terminal emulators out there.
- Highly customizable: As developers, we love customization and alacritty provides a lot room for that. It's configuration file is very well made and easy to use by just editing "alacritty.yaml" file.
- Elegant and minimal: Once you installed alacritty, the first thing you notice is very minimal, elegant UI and no clutters like UI settings and so on.
How to Install:
Simply install with
brew for mac
brew cask install alacritty
Refer official installation guide for other operating systems
by default, alacritty does not create a config file. you can take default config file from GitHub or here is my config file.
create one on this location for alacritty to read it.
Oh My ZSH!
The next tool that I cannot live without is ZSH. Zsh is also called Z shell, an extended version of Bourne Shell (sh) with plenty of features and support for plugins and themes. Usually, it may seem bash is enough for everything but once you started using zsh, you cannot go back to bash again because it provides thousands of useful features which increases your productivity.
So Why use it?
Zsh has so many features but here are some of the major ones.
- Automatic cd: Just type name of the directory
- Recursive path expansion: For example “/u/lo/b” expands to “/usr/local/bin”
- Spelling correction and approximate completion: If you make a minor mistake typing a directory name, ZSH will fix it for you
- Plugin and theme support: ZSH includes many different plugin frameworks
plugins and themes support is probably the coolest feature of ZSH.
If you're on Mac, use
brew install zsh
If you’re on Linux, the commands can vary by the distro, but it should be a default package in your package manager. You can consult this guide if you’re having trouble.
If you’re on Windows, you may not even have Bash in the first place. You can follow this guide to set that up and enable ZSH.
Your terminal never felt this good before.
Oh-My-Zsh is a famous framework for managing plugins for ZSH and it comes with plenty of plugins and themes as well.
oh-my-zsh has simple install script you can run
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Read more about zsh plugins and themes
Simply speaking, Tmux act as a windows manager within your terminal that allows you to create multiple windows and panes in a single terminal window.
here is an example of multiple panes in a single window.
So Why use it?
- Session management: Actually, in the background, all these panes and windows get its own terminal, and its managed by the tmux server so even you close your terminal application, tmux keeps the session in the background, so you can easily attach and detach to the session until you restart the machine.
- Platform independence: I can use tmux on my Macbook, my Linux notebook, Cloud servers, Raspberry Pis, BeagleBones, etc.
- customizable: There are many ways that I can customize the look and behavior of my tmux and sync this across different platforms using dotfiles.
Fortunately installing tmux is pretty straightforward on most distributions a simple
sudo apt-get install tmux (Ubuntu and derivatives) or
brew install tmux (Mac) should be sufficient.
Tmux has a prefix key to trigger functions by default it is
ctrl+b but most of the people change it to
ctrl+a here is my tmux config file
The learning curve of tmux little bit steep but worth learning, you can learn more about tmux here
Starship is a cross shell prompt and it is extremely handy to know about multiple things such as current state of git, which folder are you in, what version of the programming language you are using, and so on.
it is minimal, blazing-fast, and infinitely customizable prompt for any shell!
So Why use it?
- It saves tons of time and minimizes human errors
- It is very easy to install and customize
- Works on most of the popular shell
- Extremely faster
here is the demo video of the starship
here is quick install guide from official page
Most of the time we want a command that was used a week ago, and it is very difficult to retrieve them. yes, we all have this pain. To fix this problem I wanted to write a program that saves all my important commands into GitHub gist so I can get it back whenever I want. But later I found an application which does the exactly same thing with lot of additional features as well, that is PET.
Pet is a command-line snippet manager
It also provides code script to integrate with our shells, customizable keybindings and it also provides the option to save these commands as private or public gist.
So Why use it?
- Register your command snippets easily.
- Use variables in snippets.
- Search snippets interactively.
- Run snippets directly.
- Edit snippets easily (config is just a TOML file).
- Sync snippets via Gist or GitLab Snippets automatically.
How to install?
You can use homebrew on OS X.
$ brew install knqyf263/pet/pet
Download deb package from the releases page
$ wget https://github.com/knqyf263/pet/releases/download/v0.3.0/pet_0.3.0_linux_amd64.deb dpkg -i pet_0.3.0_linux_amd64.deb
How to use?
These are available pet commands.
$ pet --help pet - Simple command-line snippet manager. Usage: pet [command] Available Commands: configure Edit config file edit Edit snippet file exec Run the selected commands help Help about any command list Show all snippets new Create a new snippet search Search snippets sync Sync snippets version Print the version number
Pet commands are very easy to use but you can make a lot easier by following the below steps.
Instead of using
pet new, you can configure
prev command with this guide , thereafter just enter the command
prev to save your last executed command into the pet.
Select snippets at the current line (like C-r)
Rather than using
pet search command every time, you can simply assign a keybinding for it using this guide
Sync with Gist
Backup and sharing is an important thing to do and pet provides an easier way for that, using pet sync you can manually upload all your saved commands to gist, it also can be automated using
pet configure and set
auto_sync to true. Read more about pet sync
That's it for part 1, Feel free to post your favorite terminal tools on comments. See you in next the part 2 with another 5 useful terminal tools.