Some OSX Command Line Stuff

Posted by Leo Soto on July 17th, 2012.


A couple of neat tricks that I use from time to time:

  • $ mdfind: How could I be a Mac user for almost 3 years without knowing that you could use spotlight from the command line!?
  • $ purge: Flushes the disk cache. Usually, you don't mess with that stuff and just let do the OS to do its magic. Unfortunately, since installing Lion I sometimes see a huge performance degradation when many applications are being used at the same time. By running this command, after a brief pause everything returns to normal.
  • $ dnscacheutil -flushcache: I believe this is self-explanatory. Useful when useless information is obtained from a flaky proxy server and cached.
  • $ networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4: Use Google's Public DNS servers (see situation above)
  • $ networksetup -setdnsservers Wi-Fi empty: Go back to default DNS provided by DHCP.

Originally published at techblog.leosoto.com on July 17, 2012.