Spellbook
Shell incantations that I always seem to forget.
Perform an Action on Every File with a Given Extension
find . -name '*.txt' -exec echo {} \;
Write an Image to a USB Drive
First find the device path. Run lsblk before plugging the drive in and note what’s under the NAME column, then plug it in, run lsblk again, and see which device appeared.
In my case the drive came up as sdd, so that’s what goes in the of= argument:
sudo dd bs=4M if=./debian-13.1.0-amd64-netinst.iso of=/dev/sdd
Create a Favicon from an SVG
Without a favicon.ico at the root of a domain you’ll see a great many 404s in your web server logs. To make .ico files from SVG sources:
mogrify -path . -format ico -density 600 -define icon:auto-resize=128,64,48,32,16 -background 'rgba(0,0,0,0)' *.svg
Clear Out a Log File
sudo truncate -s 0 /var/log/nginx/access.log