Geek Posted April 22, 2011 Posted April 22, 2011 <div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2011/04/opensnoop-mac-filesystem-access.gif" alt="Monitor Mac OS X Filesystem Use and Access" title="opensnoop-mac-filesystem-access" width="512" height="371" class="aligncenter size-full wp-image-15220" /></p> <p>The opensnoop utility is an amazing tool for tracking down specifics like <a href="http://osxdaily.com/2010/01/27/track-an-applications-usage-in-mac-os-x/">what files specific applications are accessing</a>, but you can also use opensnoop to monitor <em>all</em> filesystem access in Mac OS X. To do this, run the utility with no flags attached:</p> <p><code>sudo opensnoop</code></p> <p>You’ll be asked for your root password, and then you’ll immediately be presented with a firehose of data showing everything that is going on within <a href="http://osxdaily.com/category/mac-os-x/">Mac OS X</a>. </p> <p>Wondering what all this information you’re seeing is? The colorized guide below shows you what you’ll be most interested in following: Purple is the Process ID, Blue is the Process Name, and Red is the File Path:</p> <p><img src="http://osxdaily.com/wp-content/uploads/2011/04/reading-opensnoop-data.gif" alt="reading opensnoop firehose data" title="reading-opensnoop-data" width="512" height="371" class="aligncenter size-full wp-image-15225" /></p> <p>Generally, the most useful information to follow is the process name and path to the file the given process is accessing. You’ll find a correspondence to what processes are shown in opensnoop with what is in the <a href="http://osxdaily.com/2010/08/15/mac-task-manager/">activity monitor / task manager</a>.</p> <p>You can also follow a specific file and discover what is accessing it with:</p> <p><code>sudo opensnoop -f /path/to/file</code></p> <p>Or you can track anything that relates to a specific file or app by using grep. For instance, I want to follow everything having to do with Terminal app or files related to it:</p> <p><code>sudo opensnoop | grep Terminal</code></p> <p>We’ve <a href="http://osxdaily.com/2010/01/27/track-an-applications-usage-in-mac-os-x/">showed you this before</a>, but you can also track specific applications with either their process id, or app name:</p> <p><code>sudo opensnoop -n Terminal</code></p> <p>Unless you’re troubleshooting very vague problems or you just want to see what’s going on behind the scenes of Mac OS X via the <a href="http://osxdaily.com/category/command-line/">command line</a>, it’s a good idea to use opensnoop with some specifics so you’re not inundated with information.</p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/T0qdAUC10eRg-9zxOiWLCuH2XcI/0/da"><img src="http://feedads.g.doubleclick.net/~a/T0qdAUC10eRg-9zxOiWLCuH2XcI/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/T0qdAUC10eRg-9zxOiWLCuH2XcI/1/da"><img src="http://feedads.g.doubleclick.net/~a/T0qdAUC10eRg-9zxOiWLCuH2XcI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=WacDE56lygA:pE_UR6HCB1g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=WacDE56lygA:pE_UR6HCB1g:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=WacDE56lygA:pE_UR6HCB1g:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=WacDE56lygA:pE_UR6HCB1g:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=WacDE56lygA:pE_UR6HCB1g:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=WacDE56lygA:pE_UR6HCB1g:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=WacDE56lygA:pE_UR6HCB1g:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/WacDE56lygA" height="1" width="1"/> View the full article
Recommended Posts