Radu Herbei
Assistant Professor of Statistics

UNIX hints for OS X

I did NOT invent these.


Update your database:sudo /usr/libexec/locate.updatedb


Join multiple pdf files from command line:
/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py -o out.pdf inputs.pdf

Split a pdf file into many. Download splitPDF.py. Then, go
splitPDF.py input.pdf splitPageNum_1 ... splitPageNum_n


Switch from bash to tcsh:
chsh -s /bin/bash $LOGNAME


Mouse-over Window Focus in a Terminal Window
defaults write com.apple.Terminal FocusFollowsMouse -string YES
Quit and restart the Terminal and enjoy! If you don't like it, re-do the command with NO instead of YES.


Create a disk image file for a folder, using hdiutil hdiutil create -srcfolder <src dir> -volname <volume name> <.dmg name>


Find large files:
mdfind 'kMDItemFSSize > 20000000'
will find files over 20,000,000 bytes.


If Spotlight doesn't behave properly, it may bebecause the indexes are damaged. Here's a fix to rebuild yourindexes:
1. Turn off indexing for your drive:
sudo mdutil -i off /Volumes/your_hard_drive
2. Remove the indexes:
sudo mdutil -E /Volumes/your_hard_drive
3. Remove the .Spotlight directories:
cd /Volumes/your_hard_drive
sudo rm -fr .Spotlight -V100

Apple Terminal tricks:

Quick Links

Site Navigation