{"id":1168,"date":"2011-01-15T05:20:47","date_gmt":"2011-01-15T13:20:47","guid":{"rendered":"http:\/\/owenmundy.com\/blog\/?p=1168"},"modified":"2011-03-15T14:07:14","modified_gmt":"2011-03-15T22:07:14","slug":"list-open-files","status":"publish","type":"post","link":"https:\/\/owenmundy.com\/blog\/2011\/01\/list-open-files\/","title":{"rendered":"UNIX: List open files"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/owenmundy.com\/blog\/wp-content\/uploads\/2011\/01\/Picture-3.png\" alt=\"\" title=\"Picture 3\" width=\"554\" height=\"242\" class=\"alignnone size-full wp-image-1169\" \/><br \/>\nCan&#8217;t eject a CD or unmount an external hard drive on your mac because of this error: <em>The disc <volume name> is in use and could not be ejected. Try quitting applications and try again.<\/em>? <\/p>\n<p>This UNIX command reports a list of all open files and applications that opened them. Open Terminal and replace the name of your volume below to test.<\/p>\n<p><code>$ lsof | grep \/Volumes\/media\/<br \/>\n<\/code><\/p>\n<p><a href=\"http:\/\/forums.appleinsider.com\/showthread.php?t=87747\">Thanks<\/a><\/p>\n<p>Addendum: Here&#8217;s an even more helpful command: eject the disk with UNIX when the GUI won&#8217;t allow it.<\/p>\n<p><code>$ diskutil eject [Mount Point|Disk Identifier|Device Node] <force><br \/>\n<\/code><\/p>\n<p>Oh, and a final tip nestled in this addition: If you have a space in the name (for example you had two disks mounted named &#8220;backup&#8221; and OSX named the second one to mount &#8220;backup 1&#8221;) then you can easily reference the name (or any file or directory name with a space) with a backslash which &#8220;escapes&#8221; the character. Typing the first few characters and then type the tab key will do it automatically.<\/p>\n<p><code>$ diskutil eject \/Volumes\/backup\\ 1\/<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Can&#8217;t eject a CD or unmount an external hard drive on your mac because of this error: The disc is in use and could not be ejected. Try quitting applications and try again.? This UNIX command reports a list of all open files and applications that opened them. Open Terminal and replace the name of [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/owenmundy.com\/blog\/2011\/01\/list-open-files\/\">Read More&#8230;<span class=\"screen-reader-text\"> from UNIX: List open files<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[42],"tags":[140,139],"class_list":["post-1168","post","type-post","status-publish","format-standard","hentry","category-code","tag-mac","tag-unix"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2ovQg-iQ","_links":{"self":[{"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/posts\/1168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/comments?post=1168"}],"version-history":[{"count":8,"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/posts\/1168\/revisions"}],"predecessor-version":[{"id":1173,"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/posts\/1168\/revisions\/1173"}],"wp:attachment":[{"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/media?parent=1168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/categories?post=1168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/owenmundy.com\/blog\/wp-json\/wp\/v2\/tags?post=1168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}