Site TIPS PAGE🔎 SEARCH  Ξ INDEX  MAIN MENU  UP ONE LEVEL
 OJB's Web Site. Version 2.1. Mac Tip.You are here: tip tips mac owen2 
Tip

Up to OJB's Mac Tips List

List Files Open on a Volume

A common problem is that when trying to eject a disk, flash drive, or other storage device, you are told it cannot be done because "one or more programs may be using it". Of course, you can just go ahead and unplug the disk anyway, but then the computer will warn you about that. Is there a way to tell what might be open on the disk?

There is a command line utility called "lsof" (list open files) which will list all the files the system has open. To show only those on a certain device, use the grep (global regular expression parser) command to show only those on the disk you are interested in. The command is this:

lsof | grep /Volumes/DISKNAME

Where DISKNAME is the name of your disk. If the disk has a space in its name remember to "escape" it using \, like this: /Volumes/Macintosh\ HD, or put it in quotes like this: "/Volumes/Macintosh HD". /Volumes is the folder where the Mac stores all the connected storage devices.

The "|" symbol is called a pipe and it takes the output of one command (lsof, which lists all the open files) and sends it to the input of another command (grep, which filters the text sent to it), a very powerful feature of Unix!



I usually write a blog post about once a week. The latest post can be viewed here: Manufactured Outrage: We might be beginning to win some battles, but the war is far from over. (posted 2024-12-17 at 19:19:15). I do podcasts too!. You can listen to my latest podcast, here: OJB's Podcast 2024-12-04 Avoid Microsoft: If you don't really like computers much you could make things a bit better for yourself..
 Site ©2024 by OJBRSS FeedWhy Macs are BestMade & Served on Mac 
Site Features: Blog RSS Feeds Podcasts Feedback Log07 Jun 2024. Hits: 208,679,270
Description: Mac TipKeywords: Macintosh,Computers,Fixing Problems,TipsLoad Timer: 11ms