Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • right. So this question was based on an application i was building to track cam usage. hence if the root user has created custom devices files accessing the cams it has to create a symbolic link to dev/video0. This makes solid sense! Thanks a lot Commented May 11, 2023 at 6:28
  • So you could do something like sudo find / -type c -ls | grep 81, 2>/dev/null to find all of the places where there might be an existing camera node and then lsof all of them. Commented May 19, 2023 at 15:29
  • 2
    @rotten Yes, but if you start down that path, this is still not guaranteed to find all of them. A process could be accessing a now-deleted inode referencing the same device. Commented May 20, 2023 at 19:30
  • So a process could mknod the device, connect to it, then spin off another process that deletes the node from the file system, but it still hangs on to it in the original thread. Surely there is a way to list open files that have been deleted from the file system? (And normally one wouldn't expect to find too many of them - especially after a reboot.) Commented May 22, 2023 at 13:50
  • 1
    @rotten You can traverse /proc/*/files or have lsof do it for you. One would not normally ever expect that for a device file. Commented May 22, 2023 at 17:13