Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command-line tool for finding out who is locking a file

I would like to know who is locking a file (win32). I know about WhoLockMe, but I would like a command-line tool which does more or less the same thing.

I also looked at this question, but it seems only applicable for files opened remotely.

like image 932
JesperE Avatar asked Oct 27 '08 19:10

JesperE


People also ask

Which command launches a tool that identifies files locked by a running process?

Using Resource Monitor, you can identify the process or service locking a file. It is an inbuilt utility in Windows 10 that helps you monitor CPU usage, memory, disk network, file handles, etc. Open Run app by pressing Windows + R hotkey and then type resmon in it. Press the OK button and Resource Monitor will open up.

How do you check which process is locking a file Linux?

lsof can help to see the list of file. here is way to see the locked files. Show activity on this post. in case lsof itself is missing on the system, ls /proc/*/fd/* | grep LOCK_FILE_NAME should provide the same information.


1 Answers

Handle should do the trick.

Ever wondered which program has a particular file or directory open? Now you can find out. Handle is a utility that displays information about open handles for any process in the system. You can use it to see the programs that have a file open, or to see the object types and names of all the handles of a program.

like image 50
fhe Avatar answered Oct 18 '22 21:10

fhe