apt-cacher-ng
When you manage more than a handful of Debian or Ubuntu systems, you quickly discover that downloading the same packages repeatedly from the internet is both wasteful and slow. Enter apt-cacher-ng, a caching proxy specifically designed for Debian package repositories. It sits between your local machines and the upstream mirrors, storing packages locally after the first download and serving them from cache for subsequent requests.
The beauty of apt-cacher-ng lies in its simplicity. Installation is straightforward: a single apt install apt-cacher-ng on a server, and you have a working proxy listening on port 3142. Client configuration is equally painless – you can either set the proxy in each machine’s apt configuration, or use the auto-detect feature if your network supports it. Once configured, every package fetched by any client is cached, dramatically reducing bandwidth usage and speeding up updates across your network.
Taskfile
Every project accumulates a collection of commands: build the thing, run the tests, deploy to staging, convert images, lint the code. These commands live in README files, shell history, or the developer’s memory. Make has been the traditional solution for decades, but its tab-sensitivity and arcane syntax make it frustrating for simple task running. Taskfile
offers a modern alternative.
Taskfile uses a simple YAML format that feels immediately familiar. Tasks have names, descriptions, and commands. Running task serve executes the serve task. Running task --list shows all available tasks with their descriptions. No tabs-versus-spaces gotchas, no implicit rules to remember, no wrestling with pattern matching when you just want to run a shell command.
find -exec
By Matthew Hunter
| Apr 2, 2023
| cli, unix
One very useful command for locating files and performing operations on them is find with the -exec option.
find [path] [arguments] -exec [command] {} \;
The part that’s tricky to remember is the escaped semicolon at the end.
Per-file vs batch mode
The \; terminator runs the command once per file found:
find . -name "*.log" -exec rm {} \;
# Equivalent to: rm file1.log; rm file2.log; rm file3.log
The + terminator batches files into fewer command invocations, which is faster: