Rebuilding the Linux Mint terminal around bat, fzf, lazygit, eza and btop — the four shell functions that made it stick, and what I removed again.
On 18 November I set out to answer one narrow question: how do I read a directory of Java files in the terminal with syntax highlighting? The answer was a single tool. The useful part was everything that followed.
This is the second wave of terminal work. The first post covered the editor and the Maven build loop — Neovim, jdtls, the inner loop. This one covers the shell around it: file viewing, fuzzy finding, Git, process monitoring, and the tools that did not survive contact with a working week.
more *.java gives you the files without colour, without line numbers and without any sense of which one changed. The obvious replacement is bat.
On Linux Mint the install succeeds and the command still does not exist:
$ sudo apt install bat
bat is already the newest version (0.24.0-1build1).
$ bat
zsh: command not found: bat
Debian and Ubuntu package the binary as batcat because bat collides with an existing package name. The fix is one alias:
alias cat='batcat'
alias bcat='batcat'
That is a real trade-off, not a free upgrade. batcat pages long files and adds line numbers, which is exactly what you want when reading source and mildly annoying when you expected cat to stream. Aliases only apply to interactive shells, so scripts that call cat are unaffected. I deliberately did not alias less: batcat -p does not pass through less flags cleanly, and breaking less +F on a log file is a worse outcome than losing colour.
batcat *.java already does the original job. The interesting part is what it enables next.
fzf is the piece that changed the loop. The apt version is 0.44.1, and the Oh My Zsh fzf plugin already provides Ctrl+R (history) and Ctrl+T (file insertion). Adding those bindings a second time is a reliable way to break both, so the config does not.
What I added instead is four functions. The first is the direct answer to the original question:
jfiles() {
fd -e java | fzf \
--preview 'batcat --color=always --style=numbers {}' \
--preview-window=right:60%
}
Type GiltVal, get the source in the preview pane, press Enter. No editor launch, no path typing, no tab-completion archaeology.
The second is the one I use more:
jsearch() {
local query
read "query?Search Java source: "
[[ -z "$query" ]] && return
rg --line-number --column --no-heading --color=never \
--smart-case "$query" -g '*.java' |
fzf --delimiter ':' \
--preview 'batcat --color=always --highlight-line {2} {1}' \
--preview-window=right:60%
}
The detail that makes it work is --line-number --column: fzf splits the result on :, so {1} is the file and {2} is the line. --highlight-line then opens the preview at the matching line instead of at the top of the file. A search that dumps you at line 1 of a 900-line class is barely better than grep.
The other two are navigation:
cproj() {
local dir
dir=$(fd --type d --max-depth 1 . "$HOME/Projects" |
fzf --preview 'eza --tree --level=2 {}') || return
cd "$dir"
}
ff() {
local file
file=$(fzf --preview 'batcat --color=always --style=numbers {}') || return
${EDITOR:-vim} "$file"
}
cproj lists the immediate children of ~/Projects with a two-level tree preview. ff finds any file and opens it in $EDITOR, which is Neovim here. Both are trivial; both remove a decision I was making dozens of times a day.
One consistency setting matters more than it looks:
export FZF_DEFAULT_OPTS="
--height=80%
--layout=reverse
--border
--info=inline
"
Without it, fzf takes over the full screen and the layout differs between call sites. The point of a picker is that it behaves the same way every time.
sudo apt install lazygit fails on this Mint base:
E: Unable to locate package lazygit
The package is not in the 24.04 repositories. The official release binary is, so the install is a short script that resolves the latest tag, detects the architecture and drops the binary into /usr/local/bin. I pinned the result at 0.66.3 and aliased lg.
The reason to keep it is hunk staging. Staging a file with git add is coarse; staging the two hunks that belong to the current change, while leaving the debugging edit out, is the operation I actually want. lazygit makes that a keystroke. It also makes branch switching and conflict resolution visible rather than remembered.
This is the one tool in the set that replaces a graphical habit rather than a command. That is a higher bar, and it passed.
eza replaces ls with colour, icons and Git status. The aliases are deliberately plain:
alias ls='eza -alh'
alias ll='eza -lh'
alias la='eza -a'
alias lt='eza -T'
alias lsd='eza --group-directories-first'
No --color=always in the alias. Forcing colour is how escape codes end up in a pipe, and then in a file, and then in a bug report.
btop (1.3.0) is the system monitor I open when Maven eats the laptop. The .zshrc already caps the Maven JVM at -Xmx768m; btop shows whether the pressure is the Maven process, a forked test JVM, or something else entirely. top answers the same question with less information and worse colours.
tmux was already installed, but the wrapper is the useful part:
t() {
emulate -L zsh
local name="${1:-main}" dir="${2:-$PWD}"
if [[ -n "$TMUX" ]]; then
if tmux has-session -t "=$name" 2>/dev/null; then
tmux switch-client -t "=$name"
else
tmux new-session -d -s "$name" -c "$dir" && tmux switch-client -t "=$name"
fi
else
tmux new-session -A -s "$name" -c "$dir"
fi
}
t work attaches to the work session or creates it in the current directory. tmux new -s fails when the session already exists; this does not. The build keeps running when the terminal closes, which is the entire point of a multiplexer.
Three things were installed or attempted and are not in the daily loop. The reasons are more useful than the recommendations.
Starship. The install script ran and starship 1.27.0 is on the machine, but there is no eval "$(starship init zsh)" in .zshrc. Powerlevel10k was already configured and doing the job. Two prompt engines solve the same problem; running both is configuration debt with no upside. The binary stays, unused, as a reminder to finish an experiment properly or not start it.
Atuin. The apt install line ran, but atuin --version reports the binary is missing — the package was not available and the install silently did not happen. That turned out to be a low-cost failure. Oh My Zsh’s history-substring-search plus fzf’s Ctrl+R already cover the common case: find a command I ran recently. Atuin’s extra value is search by directory, exit status and duration, which is a real upgrade but not one worth a second history store until the first one is visibly failing.
The “nice to have” list. mise, ast-grep, dust, jless and xh had no apt candidate on this base. They are good tools; installing each from upstream for a maybe is how a shell becomes another project to maintain. just, ncdu, tldr, yq, jq and tree did install and are available when needed, without configuration.
The pattern: a tool you do not wire into a daily action is a tool you do not use. Installing it is not the same as adopting it.
If I had to reduce the whole change to four lines, it would be the fd alias, the lg alias, jfiles and cproj. They cover browsing, navigation and Git without adding a framework.
Two things are worth doing before adding more:
time zsh -i -c exit gives a baseline. NVM and SDKMAN are the likely costs, not the new tools. A fast terminal that takes 900 ms to open is not fast.hyperfine is already installed. Compare rg against the search you used before, or batcat against less; if a tool is not faster or clearer, remove it.The terminal setup is not the work. It is the friction between me and the work. The October post removed the editor and build-loop friction; this one removed the file-finding and Git friction. Both are done when the commands are boring.
If you run a large Java reactor and want a second opinion on where the build and navigation time actually goes, send me your setup.