Categories
commands Info

Files used by a program

how to find which process is using a file?

You can view the process using the file or filesystem using lsof  & grep  command.

lsof  lists all files in use in the system.

if you want to find the application which is using the file sag.pdf  use

$lsof |grep sag.pdf

and you will get the output as

ld-linux. 4220      nandam   30r      REG        3,1   869300    136163 /home/nandam/tldp books/sag.pdf

you can also use lsof with grep to find the files used by a process
like

$lsof|grep bash