Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 10, 2022 05:28 am GMT

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
  • 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}
  • 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)
  • 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
  • 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
  • exa: Alternative to colorls (though without the icons).
  • tree: Visualize directories in a tree-like format (lightweight alternative to colorls with the -t flag).tree
  • 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.

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
  • commitizen: Get prompted to fill out any required commit fields at commit time.

Specialized Tools

Depending on what technologies you work with day-to-day,

  • jq: JSON processor.
  • 'httpie`: Command-line HTTP client (better curl).
  • k9s: Manage your Kubernetes clusters in style.k9s

Next Steps

  • 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.

Original Link: https://dev.to/timwjames/command-line-tools-for-productive-developers-pph

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To