User:JesseW/fs usage Tips

This is to be a collection of tips on useing the fabulously useful, but not very well known command line tool: fs_usage. fs_usage gives you a real-time list of filesystem and network calls that all the processes on the system are doing, as they do them. It's kind of like drinking from a firehose.

Once you have put the output of this into a file(~/foo in the example, change to suit yourself), you may find it useful to bring up the one-line summaries of each of the system calls that are made. This tip will do this for you.

whatis $(cat ~/foo | cut -f 3 -d " " | sort | uniq | sed -e 's/.*/&(2)/')

whatis brings up the one-line'ers; however, it needs "(2)" added to the end or it will find lots of useless stuff too. cut -f 3 -d " " pull out the system calls from the fs_usage output; sort and uniq do what you would think. the sed command adds the "(2)" bit.

Two good resources on fs_usage are:
 * http://rentzsch.com/macosx/fs_usageIntro
 * http://www.macworld.com/weblogs/macosxhints/2005/08/filesystemusage/index.php?lsrc=mwrss

(Also published at http://www.cocoadev.com/index.pl?FsUsageTips ; copying here for the benefit of MediaWiki history keeping. This version fully written by me.)