Command-line tools and cheatsheets
Related posts
- Introduction to command-line interface
- A checklist for the command-line interface
- Advanced Git usage patterns
- Linux at the command line
- Bindkeys
Cheatsheets
I maintain a simple private cheatsheet as a repository for the cheat tool. Among many tools for cheatsheets:
- cht.sh is very comprehensive, it works based on very simple curl calls;
- cheat handles personal cheatsheets.
Details about configuration are to be found on the cheat documentation page
https://github.com/xoolive/cheatsheets
You may set up many cheatsheet sources, with order of precedence and more.
➜ cheat ncdu
# To save results to <file>:
ncdu -o <file>
# To read from <file>:
ncdu -f <file>
# To save results to a compressed file:
ncdu -o- | gzip > <file>
# To read from a compressed file:
zcat <file> | ncdu -f-
Modern command line tools
With the recent hype around Go and Rust, a lot of common command line tools have been rewritten to benefit from the performance of the language. Of course, not all modern tools are written with these languages, but I find it still worth mentioning.
Toolname | Implementation | Alternative |
---|---|---|
exa | Rust | ls |
bat | Rust | cat |
autojump | Python | cd |
jq | C | sed (for JSON) |
neofetch | Bash | |
htop | C | top |
nvtop | C | nvidia-smi |
broot | Rust | ncdu |
fd | Rust | find |
ag | C | grep |
fzf | Go | |
dog | Rust | dig |
xh | Rust | curl |
tesseract | C++ |
Replacement tools
exa (Rust)
A replacement for the ls
command.
bat (Rust)
bat is a cat clone with syntax highlighting and Git integration. It switches to your favourite pager when needed. bat
is a great addition in your toolbox for piping results from other tools.
# Regular usage
bat readme.md
# Benefit from syntax highlighting
tail -f /var/log/syslog | bat --paging=never -l log
# Pretty diff-ing
git diff --name-only --diff-filter=d | xargs bat --diff
# Preview window with fzf
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
autojump (Python)
autojump
is a facility build around cd
, which learns about the folder you often visit. It comes with few wrapper commands like j
(jump), jo
(jump and open file manager)
➜ j fonts
/home/xo/.local/share/fonts
jq (C)
This command-line JSON processor allows to slice, filter and transform structured data. This is a whole language in itself, documented here
System management tools
neofetch (Bash)
Command-line system information tool
htop (C)
An interactive process viewer
nvtop (C)
A htop-like task monitor for NVIDIA GPU. It is particularly useful to monitor memory usage.
Disk management and fuzzy finder
broot (Rust)
This tool is a great complement to ncdu, including fuzzy search and whale-spotting.
# Start broot and with size info, dates and permissions
br -sdp
# Whale spotting (sort by size, ignored and hidden files)
br -w
# Once inside the application
:fs # filesystem analysis
:ss # sort by size
:sd # sort by date
ctrl+left # open or preview in new pane
alt+enter # open with xdg-open
c/ # search a match in file content
fd (Rust)
A simple, fast and user-friendly, alternative to ‘find’
ag, the silver searcher (C)
A code-searching tool similar to ack, but faster.
fzf (Go)
Command-line fuzzy finder
Network tools
dog (Rust)
Command line DNS client (alternate dig)
xh (Rust)
Friendly and fast tool for sending HTTP requests
Modern AI tools
tesseract (C++)
This is a performant command-line open-source OCR engine. The command-line tool wraps around the libtesseract
library which includes top-notch ML models for line and character recognition.
xh https://www.xoolive.org/images/cli/609.jpg |\
tesseract stdin stdout |\
grep --color 609