DEV Community

Cover image for Command Line Tools for Productive Developers
TimJ
TimJ

Posted on • Edited on • Originally published at timjames.dev

Command Line Tools for Productive Developers

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

  1. Download a Nerd Font and set your favourite terminal to use it. I like Cascaydia Cove Nerd Font the best.
  2. 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. tmux
    • 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: oh my tmux
  • bat: Better cat - supports syntax highlighting for a large number of programming and markup languages. bat
  • 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:
diffs() {
  diff -u $1 $2 | diff-so-fancy
}
Enter fullscreen mode Exit fullscreen mode
  • tldr: Better man (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 (for oh-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 + bat
    • 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
Enter fullscreen mode Exit fullscreen mode
  • rg: Better grep - ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern.

Directory Navigation & Management

  • colorls: Colorizes the ls output with color and icons (requires gem). colorls
    • Includes many useful flags, such as --gs for Git status, or -t for a tree view: colorls tree
    • I use an alias to replace ls with colorls:
if [ -x "$(command -v colorls)" ]; then
    alias ls="colorls"
    alias la="colorls -al"
fi
Enter fullscreen mode Exit fullscreen mode
  • exa: Alternative to colorls (use the --icons flag to get icons like colorls).
  • tree: Visualize directories in a tree-like format (lightweight alternative to colorls with the -t flag). tree
  • broot: Like tree, but works better with big directories.
  • z: Quickly jump between directories based on history (For zsh users, it is easier to install this plugin)

Utilities

  • vtop: A graphical activity monitor for the command line. vtop
  • 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. GitGUI
  • diff-so-fancy: Makes your diffs human readable instead of machine readable. diff-so-fancy
[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
Enter fullscreen mode Exit fullscreen mode
  • 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 (better curl).
  • wget: Another command-line HTTP client.
  • ngrok: Secure URL to a localhost server.
  • k9s: Manage your Kubernetes clusters in style. k9s

Next Steps

  • Customize your theme and prompt. See my guide here. Custom prompt
  • 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!

Top comments (5)

Collapse
 
mhmxs profile image
Richard Kovacs

Thanks for the article. If I should advice one more tool it would be nix package manager :)

Collapse
 
timwjames profile image
TimJ

Thanks for the recommendation, I've added a new section on package mangers

Collapse
 
georgeanderson profile image
George Guimarães

There were many cool tools I haven't heard before. Thanks for the post.

Collapse
 
igormelo profile image
Igor Melo

Very good! Many useful tools

Just a small note:

exa: Alternative to colorls (though without the icons).

exa actually has the --icons flag.

Collapse
 
timwjames profile image
TimJ

So it does. Thanks - I'll update the description.