Table of Contents#
- bat: A Cat with Superpowers
- exa: A Modern ls Replacement
- fd: Faster, Simpler Find
- rg (ripgrep): The Fastest Grep Alternative
- ncdu: Interactive Disk Usage Analyzer
- tldr: Simplified Man Pages for Busy People
- fzf: Fuzzy Finder for Everything
- ssh-copy-id: Automate SSH Key Setup
- pv: Monitor Data Transfer Progress
- tree: Visualize Directory Structures
- broot: Interactive Directory Navigator
- Conclusion
- References
1. bat: A Cat with Superpowers#
What is bat?#
bat is a Rust-written drop-in replacement for cat—but with superpowers. It adds syntax highlighting, line numbers, Git integration, and theming to make reading files (especially code) a joy.
Why It’s Useful#
- Syntax Highlighting: Automatically detects file types (Python, JSON, Markdown) and colors code.
- Line Numbers: Quickly reference lines (critical for debugging).
- Git Integration: Shows modified lines if the file is in a Git repo.
- Theming: Choose from 20+ built-in themes (e.g., Solarized, Monokai).
Installation#
- Ubuntu/Debian:
sudo apt install bat(executable isbatcat—alias withalias bat='batcat'). - Fedora:
sudo dnf install bat - Arch Linux:
sudo pacman -S bat
Usage Examples#
- View a File:
bat README.md(syntax-highlighted with line numbers). - Change Theme:
bat --theme=Monokai file.py(uses Monokai colors). - Pipe Output:
cat config.yaml | bat(format piped output).
Advanced Tips#
- Alias
cattobat: Addalias cat='bat'to~/.bashrcfor default use. - Preview in Less:
bat --pager="less -R" longfile.log(open inlesswith colors). - Git Diff Inline:
bat --git file.txt(show Git changes directly in the output).
2. exa: A Modern ls Replacement#
What is exa?#
exa is a Rust-based ls alternative designed for speed and clarity. It replaces the outdated ls with color-coded output, Git status indicators, and a tree view—all without complex flags.
Why It’s Useful#
- Color-Coded Files: Directories (blue), executables (green), symlinks (cyan)—no more guessing.
- Git Status: Shows if files are modified (
M), added (A), or deleted (D). - Tree View: Visualize directory structures with
exa -T(no need fortree). - Speed: Faster than
lsdue to Rust’s parallelism.
Installation#
- Ubuntu/Debian:
sudo apt install exa - Fedora: Enable the COPR repo:
sudo dnf copr enable atim/exa, thensudo dnf install exa. - Arch Linux:
sudo pacman -S exa
Usage Examples#
- Long List with Git:
exa -l --git(shows permissions, sizes, and Git changes). - Tree View:
exa -T -L 2(tree up to 2 levels deep). - Human-Readable Sizes:
exa -lh(KB/MB/GB instead of bytes).
Advanced Tips#
- Alias
lstoexa: Addalias ls='exa -l --git --icons'to~/.bashrcfor a richer default. - Filter Directories:
exa -l --type=dir(list only directories). - Sort by Time:
exa -l --sort=modified(order files by last edit time).
3. fd: Faster, Simpler Find#
What is fd?#
fd is a Rust-powered alternative to find—built for speed and simplicity. It skips hidden files, respects .gitignore, and uses intuitive syntax (no more -name or -type flags).
Why It’s Useful#
- Blazing Fast: Uses parallelism to search 2–3x faster than
find. - Simple Syntax:
fd "pattern"instead offind . -name "pattern". - Ignores Noise: Skips
.git,node_modules, and files in.gitignoreby default. - Case Insensitivity: Auto-detects case unless you use
--case-sensitive.
Installation#
- Ubuntu/Debian:
sudo apt install fd-find(executable isfdfind—alias withalias fd='fdfind'). - Fedora:
sudo dnf install fd-find - Arch Linux:
sudo pacman -S fd
Usage Examples#
- Search for a File:
fd "config.yaml"(findsconfig.yamlin the current directory). - Filter by Extension:
fd -e md(all Markdown files). - Search a Directory:
fd "main" src/(look for "main" insrc/).
Advanced Tips#
- Combine with xargs:
fd -e py | xargs bat(preview all Python files). - Exclude Directories:
fd "todo" --exclude=node_modules(skipnode_modules). - Case-Insensitive Search:
fd -i "readme"(findsREADME.md,ReadMe.txt).
4. rg (ripgrep): The Fastest Grep Alternative#
What is rg?#
ripgrep (or rg) is a Rust-written grep replacement optimized for code search. It’s 10–100x faster than grep for large repos and ignores binary files by default.
Why It’s Useful#
- Recursive by Default: No need for
grep -r—rgsearches subdirectories automatically. - Regex Support: Full PCRE2 regex (e.g.,
rg "def main\(\)"finds Python main functions). - Ignores Binary Files: Skips images, executables, and other non-text files.
- Output Formatting: Colors matches and shows file paths clearly.
Installation#
- Ubuntu/Debian:
sudo apt install ripgrep - Fedora:
sudo dnf install ripgrep - Arch Linux:
sudo pacman -S ripgrep
Usage Examples#
- Search Code:
rg "def main" src/(findmainfunctions in Python files). - List Matching Files:
rg --files-with-matches "TODO"(show files containing "TODO"). - Count Matches:
rg -c "error" logs/(count "error" occurrences in logs).
Advanced Tips#
- Integrate with fzf:
rg --files | fzf --preview 'rg {}'(search files and preview matches). - Exclude Patterns:
rg "password" --exclude="*.log"(skip log files). - Show Context:
rg -C 3 "bug"(show 3 lines before/after each match).
5. ncdu: Interactive Disk Usage Analyzer#
What is ncdu?#
ncdu (NCurses Disk Usage) is an interactive tool to analyze disk space. Unlike du -h, which dumps a list of sizes, ncdu lets you navigate directories, delete files, and see where your storage is going—all in a terminal UI.
Why It’s Useful#
- Interactive: Use arrow keys to browse directories and delete files with
d. - Fast: Scans large directories quickly (faster than
du). - Human-Readable: Shows sizes in KB/MB/GB.
- Lightweight: Works on servers without a GUI.
Installation#
- Ubuntu/Debian:
sudo apt install ncdu - Fedora:
sudo dnf install ncdu - Arch Linux:
sudo pacman -S ncdu
Usage Examples#
- Scan Home Directory:
ncdu ~(analyze your home folder). - Scan Root:
sudo ncdu /(check system-wide disk usage—requiressudo). - Exclude Directories:
ncdu --exclude=/home/user/Downloads ~(skip Downloads).
Advanced Tips#
- Delete Files: Navigate to a file and press
dto delete it (confirms first). - Sort by Size: Press
sto sort directories by size (default is name). - Export Results:
ncdu -o diskusage.txt(save scan results to a file).
6. tldr: Simplified Man Pages for Busy People#
What is tldr?#
tldr (Too Long; Didn’t Read) is a community-driven tool that replaces verbose man pages with quick, practical examples. Instead of scrolling through 100 lines of man git, tldr git gives you 3–5 common use cases.
Why It’s Useful#
- Quick Examples: Get straight to "how do I use this command?" (e.g.,
tldr scpshows file transfer examples). - Community-Driven: Examples are written by users—focused on real-world use.
- Cross-Platform: Works on Linux, macOS, and Windows.
Installation#
- Ubuntu/Debian:
sudo apt install tldr - Fedora:
sudo dnf install tldr - Arch Linux:
sudo pacman -S tldr
Usage Examples#
- Get Git Commit Tips:
tldr git commit(showsgit commit -m,git commit --amend). - Learn scp:
tldr scp(examples for local→remote, remote→local transfers). - Update Cache:
tldr --update(refresh the example database).
Advanced Tips#
- Search for Commands:
tldr -s "copy file"(find commands related to copying files). - Render Markdown:
tldr --render git push(view the raw Markdown examples). - Use with Aliases: Add
alias help='tldr'to~/.bashrcfor quick access.
7. fzf: Fuzzy Finder for Everything#
What is fzf?#
fzf is an interactive fuzzy search tool that works with files, command history, processes—anything. It’s not just a search tool; it’s a workflow enhancer that integrates with your shell, Vim, and more.
Why It’s Useful#
- Fuzzy Matching: Finds results even if you misspell (e.g.,
fzf→fzstill findsfzf). - Command History Search: Press
Ctrl+Rto search your terminal history interactively. - File Preview: Use
fzf --preview 'bat {}'to preview files while searching. - Integration: Works with Vim, TMUX, and shell commands (e.g.,
vim $(fzf)).
Installation#
- Ubuntu/Debian:
sudo apt install fzf - Fedora:
sudo dnf install fzf - Arch Linux:
sudo pacman -S fzf
Usage Examples#
- Search Command History: Press
Ctrl+Rin the terminal—start typing to filter history. - Search Files:
fzf(interactively search files in the current directory). - Open in Vim:
vim $(fzf)(select a file withfzfand open it in Vim).
Advanced Tips#
- Preview with Bat:
fzf --preview 'bat --style=numbers {}'(show file previews with line numbers). - Bind to Key: Add
bind '"\C-t": "fzf\n"'to~/.bashrcto openfzfwithCtrl+T. - Search Processes:
ps aux | fzf(filter running processes interactively).
8. ssh-copy-id: Automate SSH Key Setup#
What is ssh-copy-id?#
ssh-copy-id is a tiny but powerful tool that copies your SSH public key to a remote server. It replaces the error-prone process of manual key copying (e.g., cat id_rsa.pub | ssh user@host "mkdir -p .ssh && cat >> .ssh/authorized_keys").
Why It’s Useful#
- Automates Key Setup: No more manually creating
.sshdirectories or appending keys. - Prevents Errors: Avoids typos that can lock you out of a server.
- Supports Ports/Keys: Specify non-standard ports or custom keys.
Installation#
ssh-copy-id is pre-installed on most Linux systems (part of the openssh-client package). If missing:
- Ubuntu/Debian:
sudo apt install openssh-client - Fedora:
sudo dnf install openssh-clients
Usage Examples#
- Copy Default Key:
ssh-copy-id user@remote-host(copies~/.ssh/id_rsa.pub). - Specify Port:
ssh-copy-id -p 2222 user@remote-host(use port 2222). - Custom Key:
ssh-copy-id -i ~/.ssh/mykey.pub user@remote-host(use a non-default key).
Advanced Tips#
- Test Connection: After copying, run
ssh user@remote-host—you shouldn’t need a password. - Verbose Mode:
ssh-copy-id -v user@remote-host(debug issues with key copying). - Disable Password Auth: Once keys are set up, disable password login on the server (edit
/etc/ssh/sshd_configand setPasswordAuthentication no).
9. pv: Monitor Data Transfer Progress#
What is pv?#
pv (Pipe Viewer) shows progress bars for data transfers through pipes. Without pv, you’d have no idea how long a cp, dd, or tar command will take—pv adds a progress bar, speed, and ETA.
Why It’s Useful#
- Progress Bars: See how much data has been transferred (e.g.,
pv largefile.iso > /dev/sdX). - Speed/ETA: Shows transfer rate (MB/s) and estimated time to completion.
- Works with Pipes: Integrates with any command that uses pipes (e.g.,
cat | pv | grep).
Installation#
- Ubuntu/Debian:
sudo apt install pv - Fedora:
sudo dnf install pv - Arch Linux:
sudo pacman -S pv
Usage Examples#
- Copy a File:
pv largefile.iso > /dev/sdX(write to a USB drive with progress). - Extract a Tarball:
pv backup.tar.gz | tar xzf -(show extraction progress). - Monitor a Pipe:
cat logfile.txt | pv | grep "error"(track how fast data is piped togrep).
Advanced Tips#
- Adjust Buffer Size:
pv -B 1M largefile.iso > /dev/sdX(use 1MB buffer for faster transfers). - Show Rate/ETA:
pv -pterb largefile.iso(display progress, time, rate, ETA, bytes). - Alias for dd: Add
alias dd='pv | dd'to~/.bashrcto monitorddcommands.
10. tree: Visualize Directory Structures#
What is tree?#
tree is a simple tool that displays directory structures as a tree. It’s perfect for documenting projects, sharing folder layouts, or just understanding how files are organized.
Why It’s Useful#
- Visual Clarity: Shows parent/child relationships (e.g.,
src/→src/utils/→src/utils/helpers.py). - Depth Control: Limit how deep the tree goes (e.g.,
tree -L 2). - Human-Readable Sizes:
tree -hshows file sizes in KB/MB.
Installation#
- Ubuntu/Debian:
sudo apt install tree - Fedora:
sudo dnf install tree - Arch Linux:
sudo pacman -S tree
Usage Examples#
- Basic Tree:
tree(show current directory’s structure). - Limit Depth:
tree -L 2(tree up to 2 levels deep). - Show Sizes:
tree -h(display file sizes).
Advanced Tips#
- Exclude Files:
tree -I "*.log"(skip log files). - Include Hidden Files:
tree -a(show dotfiles like.gitignore). - Export to File:
tree > directory-structure.txt(save the tree to a text file).
11. broot: Interactive Directory Navigator#
What is broot?#
broot is an interactive directory navigator that combines the best of tree and fzf. It lets you browse directories, preview files, and perform actions (delete, move, open)—all in a single terminal window.
Why It’s Useful#
- Interactive Navigation: Use arrow keys or fuzzy search to move between directories.
- File Previews: See file contents (via
bat) while navigating. - Actions: Delete (
d), move (m), open (o) files without leavingbroot. - Customizable: Tweak settings (e.g., keybindings) via
~/.config/broot/conf.toml.
Installation#
The easiest way is to use the official install script:
curl -fsSL https://raw.githubusercontent.com/Canop/broot/master/install.sh | bashOr install via package managers:
- Arch Linux:
sudo pacman -S broot - Fedora:
sudo dnf install broot
Usage Examples#
- Start broot:
broot(opens the interactive navigator). - Fuzzy Search: Type
srcto jump to thesrc/directory. - Preview Files: Press
Ctrl+Pto toggle file previews (usesbatby default). - Open a File: Navigate to a file and press
oto open it (uses your default editor).
Advanced Tips#
- Configure Previews: Edit
~/.config/broot/conf.tomlto change the preview command (e.g.,preview_cmd = "bat --style=numbers {}"). - Keybindings: Press
?to see a list of keybindings (e.g.,Ctrl+Qto quit). - Integrate with Shell: Run
broot --installto add abralias and shell integration (e.g.,cdto a directory frombroot).
Conclusion#
Linux’s terminal is most powerful when you use tools that fit your workflow. The 11 commands we covered—from bat (better cat) to broot (interactive navigation)—are designed to eliminate frustration and speed up repetitive tasks.
Here’s your next step: Pick one command to master this week (e.g., bat for better file viewing). Once you’re comfortable, add another (e.g., fzf for fuzzy search). Over time, these small changes will transform your terminal into a productivity machine.
Remember: The best Linux tools are the ones you use daily. Don’t chase “shiny new things”—focus on what makes your life easier.
References#
- bat: GitHub Repo
- exa: Official Website
- fd: GitHub Repo
- ripgrep: GitHub Repo
- ncdu: Official Website
- tldr: Official Website
- fzf: GitHub Repo
- ssh-copy-id: Linux Man Page
- pv: Official Website
- tree: Official Website
- broot: Official Website
Let me know which command you’re excited to try first! 🚀