BOFH

  • systemd
  • File transfers
  • Multipath
  • Top # disk size
    du -m PATH | sort -nr | head -n LIMIT
  • Random password generators
    • uuidgen | sha256sum
    • head --bytes=32 /dev/urandom | base64
    • tr -dc A-Za-z0-9 </dev/urandom | head -c 40
    • openssl rand -hex 32
  • List open ports
    • sudo netstat -tulpn | grep LISTEN
    • sudo ss -tulpn
  • Transfers
    • rclone copy --stats=1s --verbose=1 SERVER1:/SERVER-SOURCE/PATH SERVER2:/SERVER-DESTINATION/PATH
  • DNS
    • Reverse own IP
      • host `curl https://wtfismyip.com/text`
      • dig -x `curl https://wtfismyip.com/text`
  • Delete all files matching name
    • find PATH -name FILENAME -type f -delete
      • find PATH -name "FILENAMEWITHWILDCARD*" -type f -delete
    • find PATH -name FILENAME -print0 | xargs -0 rm
    • find PATH -name FILENAME -exec rm {} +
  • Linux host
    • Get:
      • hostnamectl
    • Set:
      • hostnamectl set-hostname HOSTNAME
  • SSH
    • Check keys
      • for key in ~/.ssh/id_*; do ssh-keygen -l -f "${key}"; done | uniq
    • Generate an Ed25519 key
      • ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "USERNAME"
    • Copy key to server
      • ssh-copy-id -i ~/.ssh/id_ed25519.pub USER@SERVER