Skip to content

Lesson 10 — Modern Terminal Toolkit

Your config installs a curated set of modern CLI tools — each a drop-in replacement for a classic Unix command with better output, faster performance, or smarter behaviour. They're all configured through Home Manager in vendor/nixproject/modules/home/cli.nix.


bat — better cat

bat file.txt          # syntax-highlighted output with line numbers
bat file.py           # auto-detects language
bat -n file.txt       # line numbers only (no git diff markers)
bat -p file.txt       # plain output (no decorations) — pipe-friendly
bat *.nix             # multiple files with headers between them

bat also integrates with other tools. Setting BAT_THEME controls the colour scheme. Catppuccin Mocha theme is a good match for your system theme:

export BAT_THEME="Catppuccin Mocha"

Use it as your pager for man pages — add to your shell config:

export MANPAGER="sh -c 'col -bx | bat -l man -p'"


eza — better ls

eza is already aliased via Home Manager. Common usage:

eza                   # basic listing
eza -l                # long format with permissions, size, date
eza -la               # include hidden files
eza -lT               # tree view (replaces `tree`)
eza -lT --level=2     # tree limited to 2 levels deep
eza --git             # show git status per file
eza -l --sort=size    # sort by file size
eza -l --sort=modified # sort by modification time

ripgrep (rg) — better grep

Faster than grep, respects .gitignore, and has sane defaults for searching code.

rg "search term"              # search current directory recursively
rg "pattern" src/             # search a specific directory
rg -l "pattern"               # list matching files only (no content)
rg -n "pattern"               # show line numbers
rg -i "pattern"               # case-insensitive
rg "pattern" -g "*.nix"       # only search .nix files
rg "pattern" --type nix       # same, using named type
rg -v "pattern"               # invert — lines NOT matching
rg --hidden "pattern"         # include hidden files and directories
rg "foo" -A 3 -B 3            # 3 lines of context after and before each match

Unlike grep, rg skips .git/, node_modules/, and anything in .gitignore automatically.


fd — better find

fd pattern                    # find files matching pattern (by name)
fd -e nix                     # find by extension: all .nix files
fd -t f pattern               # files only (not directories)
fd -t d pattern               # directories only
fd pattern src/               # search within a specific directory
fd -H pattern                 # include hidden files
fd -E vendor pattern          # exclude a directory
fd --changed-within 1d        # files modified in the last day

The pattern is a regex by default, but most simple names just work as-is.


dust — better du

Visual disk usage. Run it in a directory to see what's eating space:

dust                          # usage breakdown of current directory
dust /home/marcus             # specific directory
dust -n 20                    # show top 20 entries (default is 20)
dust -d 2                     # limit depth to 2 levels
dust -r                       # reverse order (smallest first)

btop — better top/htop

Launch with:

btop

Key bindings inside btop:

Key Action
Esc / q Quit
F2 / o Options menu
h Help
p Sort processes by CPU
m Sort processes by memory
k Kill selected process
/ Filter processes
Change selected process field

Mouse works too — click on panels to select, scroll to navigate.


fzf — fuzzy finder

fzf is a general-purpose interactive filter. You pipe things into it and get interactive search.

# Fuzzy-search your command history (replaces Ctrl-R)
Ctrl-R                        # already wired up by Home Manager

# Fuzzy-find a file and open it
nvim $(fzf)

# Fuzzy-find and cd into a directory
cd $(find . -type d | fzf)

# Preview file contents while searching
fzf --preview 'bat --color=always {}'

# Fuzzy-search git branches and check one out
git branch | fzf | xargs git checkout

Home Manager wires Ctrl-R (history search) and Ctrl-T (file search) automatically.


zoxide (z) — smarter cd

z learns which directories you visit and lets you jump to them by a partial name.

cd ~/Developer/nixlessons     # normal cd — zoxide records this
z nixlessons                  # jumps to ~/Developer/nixlessons
z nix                         # jumps to the most-visited dir containing "nix"
z -                           # go back to previous directory
zi                            # interactive mode (uses fzf to pick)

The more you use it the smarter it gets. After a few days it learns all your frequent paths.


tldr — simplified man pages

Community-written quick-reference cards for common commands.

tldr tar                      # common tar examples
tldr ffmpeg                   # ffmpeg examples
tldr git                      # git examples
tldr --update                 # update the local cache

Use tldr first to get the most common usage, then man for the full reference if you need something specific.


yazi — terminal file manager

A TUI file manager with image previews (where supported), fast navigation, and good Vim-style keybindings.

yazi                          # launch in current directory
yazi ~/Downloads              # launch in a specific directory

Key bindings inside yazi:

Key Action
h j k l Navigate (left/down/up/right, Vim-style)
Enter Open file or enter directory
Backspace Go up a directory
Space Select/deselect file
y Yank (copy) selected
x Cut selected
p Paste
d Move to trash
D Delete permanently
r Rename
/ Search
q Quit
. Toggle hidden files
~ Go to home directory

Press ? inside yazi for the full help screen.

Shell integration — when you quit yazi with q, it can change your shell's working directory to wherever you ended up. Home Manager wires this up via a shell function. Use the y function instead of the yazi command:

y                             # launch yazi with cwd-on-quit integration

After quitting, your terminal is in the directory you were browsing.


atuin — synced shell history

Atuin replaces your shell history (Ctrl-R) with a searchable, timestamped, cross-machine synced database. Your config syncs to https://atuin.wilsoz.com.

# Interactive search (also triggered by Ctrl-R)
atuin search

# Search for a specific command
atuin search "nixos-rebuild"

# Show stats about your most-used commands
atuin stats

# Sync manually (runs automatically every 5 minutes)
atuin sync

# First-time setup on a new machine (links to the shared history)
atuin login -u <username> -k <key>
atuin sync

Once you're logged in, Ctrl-R gives you a full history search across both the EliteBook and MacBook Air.


Putting it all together

These tools are designed to combine. Some patterns that become second nature:

# Find a file and preview it
fd ".nix" | fzf --preview 'bat --color=always {}'

# Search code and pipe results into fzf for selection
rg -l "home.packages" | fzf

# Navigate to a frequently-visited project
z nixlessons

# See what's filling up your disk quickly
dust ~/

# Check what a command does before looking at the man page
tldr rsync