Handy Terminal Commands I Keep Coming Back To (macOS, Windows, Linux)

A running list of commands I keep having to look up. Bookmark it and steal whatever is useful. macOS Back up your list of installed apps Handy before reinstalling macOS or setting up a new Mac: brew list > ~/Desktop/brew_installed_apps.txt mas list > ~/Desktop/macappstore_apps.txt # needs: brew install mas Better still, make a Brewfile that can reinstall everything in one go: brew bundle dump --file=~/Desktop/Brewfile brew bundle --file=~/Desktop/Brewfile # on the new Mac Download a video with yt-dlp brew install yt-dlp ffmpeg # as MP4 yt-dlp --recode-video mp4 "URL" # audio only, as MP3 yt-dlp -x --audio-format mp3 "URL" Only download things you have the right to keep. ...

How to Sort Photos into Device/Year/Month/Day Folders with exiftool and Python

Old phone backups and SD card dumps end up as one giant folder of IMG_1234.HEIC files. This script reads the camera model and capture date from each file’s metadata and moves it into: Sorted Pictures/ └── iPhone 13/ └── 2023/ └── 07/ └── 14/ └── IMG_1234.HEIC What makes it safe Dry run by default. Nothing changes until you add --move. Moves, never copies. On the same drive that’s a true rename, so created and modified dates are preserved. Never overwrites. Name clashes get _1, _2 and so on. Re-runnable. The output folder is skipped when scanning. Step 1: Install the tools These steps are for macOS, but the script works anywhere Python 3 and exiftool are installed. ...