Update your terminal

I’ve gotten into the habit of tweaking my development environment on a regular basis. I do this to either try something new, improve my productivity, or for no reason at all. One thing that definitely deserves some care is the terminal/shell, which is something I spend most of my time in.

I’m going to share my tips with you. Let me know if you’ve tried any of these!

.dotfiles

What are dotfiles? These are configuration files on *nix-based systems that allow you to customize your system to a certain extent. For more details, I suggest Intro to Dotfiles and GitHub’s unofficial guide to dotfiles.

Since dotfiles provides you with the flexibility to customize your system, it goes without saying that configuring your system to meet your needs can yield some improvements to your workflow.

Management via Version Control

This doesn’t apply to your terminal and is applicable for any settings you wish to have in version control. I’ve found that using a bare git repository worked extremely well for how I wanted to manage my personal dotfiles. However, this may not work for everyone and there are various other ways people have maintained their own dotfiles out there by using additional tools or scripts to help copy/link things. I was most inspired by Nicola Paloucci’s method, which includes how to start your dotfiles repo from scratch and “install” it onto your computer again.

However, there is another feature of git that also helps keep your environments in sync without having to resort to installing scripts for everything. This is the git-submodule feature. For certain utilities/frameworks, I tend to opt for git-based installs over using package managers. It’s super easy to version by adding the tool/software via git submodule add and have it versioned with the rest of my configuration files.

What are some of them you may ask? There are things like oh-my-zshasdfpure, and various zsh-plugins to name a few. You can do this with a lot of tools that have the option to do installations that way. This would allow us to keep things versioned and with a single command set up our things with almost the same tooling.

Here is a small excerpt from my own personal dot files of the .gitmodules file:

[submodule ".asdf"]
	path = .asdf
	url = https://github.com/asdf-vm/asdf.git
[submodule ".oh-my-zsh"]
	path = .oh-my-zsh
	url = https://github.com/robbyrussell/oh-my-zsh.git

This is especially so when software can be a tad bit hard to keep up-to-date and in sync across many different environments. This is something I’ll be looking into with how to deal with OSX, Linux, and WSL environments separately. This might just be a single bash script that is managed with their respective package/software/repo managers. However, being able to bootstrap your dev environment with your own preferences without having to maintain scripts to do the entire process for you is a huge win.

Feel free to check out my dotfiles.

Aliases

There’s a blog post by Brad that briefly touches on aliases. He describes configurations that can help improve your workflow in the terminal. Personally, I found writing these from scratch and adding them over time lets me actually remember what these aliases are instead of using aliases written by someone else. We all have our own way of naming things and such. I’ll showcase some interesting aliases below as well.

Awesome CLI Software/Tools

Here is a short list to get you started. For added ❤ I even created some screencasts for you. These tools should help ease your workflow a bit more in the terminal.

Stuff I use on a daily basis to get things done:

Z shell (Zsh)

I like using zsh as my main shell. It provides a lot of nice features out of the box, which bash does support in some way. A few features to name is the file globbing, directory traversal shortcuts, and path expansion for when I’m too lazy to type a lot of things. But I’ve managed to get around my own laziness with insert tool here

fzf

A friend of mine introduced this one to me earlier this year when I started to use Vim as my editor again. It isn’t a utility specific to Vim, but it does provide some support to it with a plugin. For a simple description, the README does provide a general idea as to what the tool is and what it does.

It’s a general-purpose command-line fuzzy finder.
It’s an interactive Unix filter for command-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc.

It is a great utility to help build aliases/workflows that make doing certain things easier in the terminal. By default, the key-binding to use fzf directly is with Ctrl+T.

I screencasted some new things I’ve added to my toolbox on a daily basis. Worth mentioning here that there are some custom functions written that use fzf to do fancy things with git.

What you’re seeing in this screencast:

  • performing a simple fuzzy search inside a directory to execute various actions
  • switching branches on a git repository with ease
  • cherry-picking by using commit messages

Player not working? Here’s the link.

bat

bat README.md

There are times when a diff output simply isn’t enough when reviewing a change that you’ve made. We have a few options: use a GUI (your editor or for git) or with bat in your terminal by embracing your nerdiness.

I also screencasted some use cases:

Player not working? Here’s the link.

Other Tools/Utilities

Here is a list of other tooling I’ve used as well, and a link to a collection of various other CLI tools that you may find helpful:

We're building an AI-powered Product Operations Cloud, leveraging AI in almost every aspect of the software delivery lifecycle. Want to test drive it with us? Join the ProdOps party at ProdOps.ai.