Few tips for mac

- 2min
  • Add script here : /usr/local/bin

  • Screenshot system : defaults write com.apple.screencapture name “Anything you like”; killall SystemUIServer

  • Size of dock icons : defaults write com.apple.dock largesize -int 512; killall Dock

  • Hidden files shown : defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder

  • Zip a file with a password: zip -e [archive] [file]

  • Zip a folder: zip -r [archive] [folder]

  • Zip a folder with a password: zip -re [archive] [folder]

  • Delete every file starting with ._ : dot_clean -m .

  • Alternative:

    • Command-line rename utility:
      • install Xcode if not already done
      • install Homebrew if not already done
      • install rename : brew install rename
      • in the terminal:
      rename -d img_ * # to strip away the prefix
      rename "s/^img_//" * # with a regex
      
      rename is useful to rename easily files on terminal
  • How To Block Websites on Your Mac Using Terminal:

    • Edit /etc/hosts
    • Add 127.0.0.1 https://www.google.com/ (exemple)
    • Execute this to update: sudo dscacheutil -flushcache
  • Clean DNS Cache:

    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder or sudo dscacheutil -flushcache

  • Path for user’s dictionaries : ~/Library/Dictionaries