Linux tools that you never knew you needed

Linux tools that you never knew you needed

Apr 07, 2021
#linux #tips #tech

1. bat - (cat alternative) #

  • bat: A cat(1) clone with syntax highlighting and Git integration.
  • Example:

2. fd - (find alternative) #

  • fd: a simple, fast and user-friendly alternative to find.
  • Examples:

3. httpie - (wget/curl alternative) #

  • httpie: a user-friendly command-line HTTP client for the API era. It comes with JSON support, syntax highlighting, persistent sessions, wget-like downloads, plugins, and more.
  • Examples:
# Hello world
$ http httpie.io/hello
# Custom HTTP method, HTTP headers and JSON data
$ http PUT pie.dev/put X-API-Token:123 name=John
# Submitting forms
$ http -f POST pie.dev/post hello=World
# Upload a file using redirect input
$ http pie.dev/post < files/data.json
# ...
# For more examples, check out: https://httpie.io

4. ripgrep - (grep alternative) #

  • ripgrep: a faster grep. ripgrep is a line-oriented search tool that recursively searches your current directory for a regex pattern. By default, ripgrep will respect your .gitignore and automatically skip hidden files/directories and binary files.
  • Benchmark.
  • Examples:
# Basic use
$ rg fast README.md
# Regular expressions
$ rg 'fast\w+' README.md
# Recursive search - recursively searching the directory (current directory is default)
$ rg 'fn write\('
# ...
# For more examples, checkout: https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md

5. delta #

  • delta: Code evolves, and we all spend time studying diffs. Delta aims to make this both efficient and enjoyable: it allows you to make extensive changes to the layout and styling of diffs, as well as allowing you to stay arbitrarily close to the default git/diff output.
  • Diff/git diff doesn’t show you exactly what was changed.
  • Delta shows within-line highlights based on a Levenshtein edit inference algorithm.
  • By default, delta restructures the git output slightly to make the hunk markers human-readable:
  • Example config:
[core]
    pager = delta

[delta]
    plus-style = "syntax #98c379"
    minus-style = "syntax #e06c75"
    syntax-theme = OneHalfDark
    navigate = true
    features = line-numbers decorations

[interactive]
    diffFilter = delta --color-only
  • Completely replace diff with delta:
alias diff="delta"

6. z #

  • Tired for cding into the same directories over and over? Save your time with z command!
  • z: jump around. Z is a shell script that makes jumping around your file directory pleasantly simple. Instead of trying to remember the exact path of where you need to go, or worse, cding into the next directory followed by lsing and then cding again over and over (we’ve all been there), Z allows you to “lazy type” where you want to go and it’ll handle the rest.
  • Examples:
# Takes me to my workspace folder from anywhere.
$ z workspace

7. fzf #

  • fzf: fzf is a general-purpose command-line fuzzy finder.
  • It’s an interactive Unix filter for command-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc.
  • Examples:
# Read the list from STDIN and write the selected item to STDOUT
$ find * -type f | fzf > selected
$ vim $(fzf)
# COMMAND **<TAB>
# Files under the current directory
# - You can select multiple items with TAB key
$ vim **<TAB>

# Files under parent directory
$ vim ../**<TAB>

# Files under parent directory that match `fzf`
$ vim ../fzf**<TAB>

# Files under your home directory
$ vim ~/**<TAB>


# Directories under current directory (single-selection)
$ cd **<TAB>

# Directories under ~/github that match `fzf`
$ cd ~/github/fzf**<TAB>

# Can select multiple processes with <TAB> or <Shift-TAB> keys
$ kill -9 <TAB>

$ unset **<TAB>
$ export **<TAB>
$ unalias **<TAB>
# ...
# For more examples, checkout: https://github.com/junegunn/fzf

8. thefuck #

  • thefuck: Magnificent app which corrects your previous console command.
  • Examples:
$ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

$ fuck
sudo apt-get install vim [enter/↑/↓/ctrl+c]
Reading package lists... Done
...
# ...
# For more examples, check out: https://github.com/nvbn/thefuck

9. exa - (ls alternative) #

  • exa: A modern replacement for ls. exa is an improved file lister with more features and better defaults. It uses colours to distinguish file types and metadata. It knows about symlinks, extended attributes, and Git. And it’s small, fast, and just one single binary.
  • Examples:
  • Completely replace ls with exa:
alias ls="exa"