How find out which process is using a file in Linux?

khris picture khris · Jul 3, 2014 · Viewed 154.9k times · Source

I tried to remove a file in Linux using rm -rf file_name, but got the error:

rm: file_name not removed.  Text file busy

How can I find out which process is using this file?

Answer

jimm-cl picture jimm-cl · Jul 3, 2014

You can use the fuser command, like:

fuser file_name

You will receive a list of processes using the file.

You can use different flags with it, in order to receive a more detailed output.

You can find more info in the fuser's Wikipedia article, or in the man pages.