The Command Line: Part 2

— 2 minute read

If you are familiar with the command line or have read my previous article, there are still some improvements you can make.

Some of these improvements require other utilities. If you’re on a Mac, then you should be able to install most of them using brew – find out more information at have a read of my quick summary of Homebrew.

Cat or Bat? permalink

You might be familiar with cat which can be used to read the contents of a file. However, it looks a little boring. This is where bat comes in… You can install bat with Homebrew:

brew install bat

Then add an alias, so your muscle memory of cat gives you the desired output.

alias cat="bat"

Syntax Highlighting permalink

You can configure ZSH in many different ways. One way to improve your experience is using syntax highlighting. I am sure you have it in your editor of choice (Visual Studio Code), but you can also have it on your command line. You will need to use brew to install the package;

brew install zsh-syntax-highlighting

Then add the source to your ~/.zshconfig;

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

Themes & Fonts permalink

In the ~/.zshconfig you need to change the ZSH_THEME to the appropriate theme. I use the agnoster theme. Next, I set the default user, which removes your username from the command line path;

DEFAULT_USER=`whoami`

Finally, I tweak the command line font, using a Powerline font. Currently, I am using Meslo at 14pt. In the past, I have used Source Code Pro.


If you want even more improvements, I suggest reading Remy’s article “CLI Improved” for more tips and tricks. And check out Kevin Smets tutorial where I got most of my ideas for this set up from.