https://saurabhs.org/advanced-macos-commands (https://archive.ph/s2jcm)

MacOS

  • cmd + shift + . - toggle hidden files

CLI

  • history shows command history
  • Repeat commands from history by adding ! then line number e.g. !406 will run the command on line 406
  • Prefix the last command with !! e.g. sudo !!

https://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file

git ls-files -z | while IFS= read -rd '' f; do if file --mime-encoding "$f" | grep -qv binary; then tail -c1 < "$f" | read -r _ || echo >> "$f"; fi; done

pg_dump

docker run --net=host --rm postgres:14-alpine /bin/bash -c "PGPASSWORD=alfred pg_dump -p 5432 -U alfred -d alfred_db -h localhost --create --inserts" > dump.sql

MacOS Startup

  • /Library/LaunchAgents/
  • /Library/LaunchDaemons/
  • ~/Library/LaunchAgents
  • sudo launchctl list
  • sfltool dumpbtm
l /Library/LaunchAgents/
l /Library/LaunchDaemons/
l ~/Library/LaunchAgents

Zip

zip -r Companies.zip ./Companies -x "*.DS_Store" "*/node_modules/*" "*._*" "*/.angular/*" "*/.terraform/*"