Knowing how to use the command line–and how to use it well–is often a necessary skill. I love working on the command line, and I love discovering new tools that I can use. Here are a few that I use every day, all of which have greatly boosted my productivity.
Homebrew
Homebrew is the best package manager for macOS. Period. I get the majority of the command line tools that I use (and all of the ones mentioned in this post) from Homebrew. Installing a new tool is as simple asbrew install package-name
. If I can’t find a package on Homebrew, the likelihood that I’ll install it drops drastically.
Fasd
Fasd is my favorite way to navigate around my computer. It ranks your files and folders based on how frequently and recently (a.k.a “frecency”) you use them. Jumping to/a/very/long/path/that/you/thought/would/be/easy/to/remember
is as simple as typing inz rem
. Thez
command is a built-in alias that they provide and list in their documentation. Fasd simplifies working with files and directories.
direnv
direnv is a directory-specific environment switcher. It evaluates a local.envrc
file (if there is one) when entering a directory. That means you can have environment variables, aliases, functions, and more details that are specific to local directories.
On one of my projects, I want to set environment variables SINGLE_PROCESS
, NODE_ENV
, PATH
, TS_NODE_FAST
, and more. However, I don’t always want these set, so it wouldn’t make sense to put them in my.profile
. I also have some project-specific aliases, but I’ll never need to use them outside of this project.
This is where direnv comes in. It loads the.envrc
when entering the directory, and unloads when leaving it.
fzf
fzf is like less
with built-in fuzzy-find. Run history | fzf
, and start typing a command that you sort of remember. Orfind . | fzf
to look for the path to a file. Any time that you might use less
, fzf
is a good alternative.
ripgrep
ripgrep is a blazing-fast alternative to grep. It searches for regex patterns and ignores files and directories in .gitignore
by default.
Virtual Environments
One of the challenges of working on different projects is managing lots of different software versions. While I don’t personally use Docker for this, some people report good luck with using it as a development tool to solve this very problem.
I personally just use virtual environments: nvm for Node, pyenv for Python, rbenv for Ruby, etc. I’m sure there are reasons to choose nodenv or nvm or n, but I don’t have a strong preference here. Virtual environments reduce the pain of working with different versions.
Say I’m working on a Python 2.7.10 project and a Python 3.5.2 project at the same time, and both use the same library. In this case, I don’t want to install a library globally because they’ll have different dependencies. Creating separate virtual environments will isolate both projects and keep them apart from each other.
What are your go-to command line tools?
I use vi extensively in my development workflow
In order to accommodate the faceroll and many mistakes that I make I use [The Fuck] (https://github.com/nvbn/thefuck).
Thanks for the suggestion Kent.
I’ve used that in the past, but it’s been pretty slow for me lately. I haven’t taken the time to debug it either, so I’ve stopped using it.
In Appropriate!
Thank you Dan, very cool!