Awesome OS X Command Lines
Thank you @herrbischoff for creating this A curated list of shell commands and tools specific to OS X and functions.
Here area a couple of my favorite commands:
Safari
Enable Develop Menu and Web Inspector. This is great because it's always a pain to figure out where to turn things on and off within Safari preferences.
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true && \
defaults write com.apple.Safari IncludeDevelopMenu -bool true && \
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true && \
defaults write -g WebKitDeveloperExtras -bool true
Spotlight
Erase Spotlight Index and Rebuild. I do like Spotlight and this makes it easier to index an external drive or maybe something on a network.
mdutil -E /path/to/volume
Search via Spotlight
mdfind -name 'searchterm'
Files
I can't stand .DS_Store
but this little script makes my life super easy by recursively deleting .DS_Store
files.
find . -type f -name '*.DS_Store' -ls -delete
DHCP
Renew DHCP Lease is helpful when you're doing full-stack web development.
sudo ipconfig set en0 DHCP
TCP/IP
This outputs all applications currently using port 80. Super helpful!
sudo lsof -i :80
Show External IP Address keeps me from having to open up a browser and visit http://www.whatsmyip.org/.
dig +short myip.opendns.com @resolver1.opendns.com
Show Local IP Address keeps me from having to open up System Preferences > Network
.
ipconfig getifaddr en0
Wi-fi
Show Wi-Fi Connection History is really handy if you do lot of work at coffeeshops.
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7
Audio
Convert audio file to iPhone ringtone is like the coolest thing ever!
afconvert input.mp3 ringtone.m4r -f m4af
Create Audiobook From Text is great for Podcast/Audible lovers like me.
say -v Alex -f file.txt -o "output.m4a"
Hardware
List all hardware ports is helpful if you're doing work with Raspberry Pi or Arduino.
networksetup -listallhardwareports