Misc OS X terminal commands

Misc OS X terminal commands

Wed, 01 Aug 2007

Make those little arrows do something useful in iTunes. This makes the arrows link to items in your library. Hold the option key to link to the iTunes Store.

In the terminal:
defaults write com.apple.iTunes invertStoreLinks -bool YES


Disable the automatic backup of your iPhone/iPod Touch when syncing in iTunes. To do a manual backup control-click on the device in the sidebar, and select Back Up.

In the terminal:
defaults write com.apple.iTunes AutomaticDeviceBackupsDisabled -bool true


Install a software package from the terminal (great for installing on a remote machine)
sudo installer -pkg /path/to/package.pkg -target /


Count the number of lines in a text file
wc -l foo.txt


mount firewire drives before login (great for servers or other times when you need access to the drive, without having to login to the machine)
sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true


Turn off Spotlight (particularly useful on Servers and scratch disks)
sudo mdutil -i off /Volumes/drivename

now lets remove all trace of Spotlight:
Remove index Spotlight
sudo mdutil -E /Volumes/drivename

Remove Spotlight directory
sudo rm -r .Spotlight-V100


Running an Applescript from the terminal (beep in this case)
osascript -e 'tell application "Finder" to beep'


Get Interarchy on a remote machine to download a large file (in the background)
osascript -e 'tell application "Interarchy" to webfetch url "http://path"'&


How about some useful shortcuts. Add these to your ~/.profile

alias ttop='top -ocpu -R -F -s 2 -n30'
alias ll='ls -al'

return to list