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

linux

Solution

You can use the `fuser` command, which is part of the `psmisc` package, 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.

Problem

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?

Original source