Reputation: 18184
Today I had the problem that I couldn't delete a folder because "it was busy".
How can I find out which application to blame for that or can I just delete it with brute force?
Upvotes: 14
Views: 54991
Reputation: 11338
lslocks
lists information about all the currently held file locks in a Linux system. (part of util-linux) this utility has support for json output, which is nice for scripts.
~$ sudo lslocks
COMMAND PID TYPE SIZE MODE M START END PATH
cron 873 FLOCK 4B WRITE 0 0 0 /run/crond.pid
..
..
Upvotes: 8
Reputation: 83943
fuser
will show you which processes are accessing a file or directory.
Upvotes: 3