Command Line Tools for Productive Developers
TimJ
Posted on April 10, 2022
This guide is a compilation of various command line tools that will improve your productivity in addition to various quality-of-life features.
Note: for any npm
packages, make sure to install globally with -g
.
Getting Started
- Download a Nerd Font and set your favourite terminal to use it. I like
Cascaydia Cove Nerd Font
the best. - See my guide for setting up a custom prompt and various plugins using oh-my-zsh. This also includes some useful aliases, keybinds and terminals to use for different platforms.
General Productivity
-
tmux
: Terminal multiplexer that gives you tabs, panes and more natively in the shell. With tmux, you can detach terminal sessions so that they continue running in the background, restore sessions, and even reattach them to a different terminal.- See this blog to get started with tmux.
- See my
.tmux.conf
. - Alternatively, you can also use oh-my-tmux along with a bunch of plugins to extend the capabilities of tmux. See my
.tmux.conf.local
which has my current configuration using this framework. This is what my tmux looks like, with a customized status bar:
-
bat
: Bettercat
- supports syntax highlighting for a large number of programming and markup languages. -
diff-so-fancy
: Makes your diffs human readable instead of machine readable. Go here to see usage with Git.- Can be used with
diff
, as in this alias:
- Can be used with
diffs() {
diff -u $1 $2 | diff-so-fancy
}
-
tldr
: Betterman
(manual) pages. -
thefuck
: Corrects errors in previous console commands. -
how2
: Finds the simplest way to do something in a unix shell using a natural language query. -
direnv
: Load and unload environment variables depending on the current directory (foroh-my-zsh
users, see this alternative) -
asdf
: Manage multiple runtime versions with a single CLI tool. -
glow
: Terminal based markdown reader.
Search
-
fzf
: General-purpose command-line fuzzy finder.- fzf can be used for tab completion, history search and more.
- If you are using oh-my-zsh, add
fzf
to your plugins for keybinds and more. - You can use fzf to search and
bat
for file previews using this alias:
if [[ -x "$(command -v fzf)" ]] && [[ -x "$(command -v bat)" ]]; then
alias fp="fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"
fi
-
rg
: Bettergrep
- ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern.
Directory Navigation & Management
-
colorls
: Colorizes thels
output with color and icons (requiresgem
).- Includes many useful flags, such as
--gs
for Git status, or-t
for a tree view: - I use an alias to replace
ls
withcolorls
:
- Includes many useful flags, such as
if [ -x "$(command -v colorls)" ]; then
alias ls="colorls"
alias la="colorls -al"
fi
-
exa
: Alternative tocolorls
(use the--icons
flag to get icons likecolorls
). -
tree
: Visualize directories in a tree-like format (lightweight alternative tocolorls
with the-t
flag). -
broot
: Like tree, but works better with big directories. -
z
: Quickly jump between directories based on history (Forzsh
users, it is easier to install this plugin)
Utilities
-
vtop
: A graphical activity monitor for the command line. -
croc
: Simple file transfer via CLI. -
secman
: CLI password manager. -
hyperfine
: A command-line benchmarking tool. -
gping
: Ping, but with a graph. -
procs
: Replacement for ps. -
dog
: Command-line DNS client. -
duf
: A better df alternative.
Git
-
gh
: GitHub CLI - view pull requests, issues, and other GitHub concepts in the terminal. -
gitui
: Git GUI in your terminal. -
diff-so-fancy
: Makes your diffs human readable instead of machine readable.- Add the following to your
.gitconfig
:
- Add the following to your
[alias]
dsf = diff --color
[interactive]
diffFilter = diff-so-fancy --patch
[color]
ui = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = 11
frag = magenta bold
func = 146 bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
- commitizen: Get prompted to fill out any required commit fields at commit time.
Package Mangers
There are a wide range of different package managers for different environments (e.g., APT
for Ubuntu
) and languages (e.g., pip
for python
), but here are some general package managers that are good to have:
- Homebrew: MacOS, but also available on Linux.
- Chocolatey: Windows.
- nix: For Unix systems, functional package manager.
-
npm: Package manager for
node
, but good to have.
Specialized Tools
Depending on what technologies you work with day-to-day, these may or may not be relevant:
-
jq
: JSON processor. -
httpie
: Command-line HTTP client (bettercurl
). -
wget
: Another command-line HTTP client. -
ngrok
: Secure URL to a localhost server. -
k9s
: Manage your Kubernetes clusters in style.
Next Steps
- Customize your theme and prompt. See my guide here.
- Use oh-my-zsh to install some zsh plugins. I've created a guide for that here. Some notable plugins include:
- Autocomplete
- Autosuggestions
- Syntax highlighting
-
.env
auto loading - Clipboard CLI utilities
-
web-search
for using search engines via CLI
- Create some aliases for frequently used commands. See all my aliases in my
aliases.zsh
. Note that for git aliases, it is best to define them in your.gitconfig
.
Feel free to add a comment suggesting any additional CLI tools and I'll add them to the list!
💖 💪 🙅 🚩
TimJ
Posted on April 10, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.