I want to remove a file in my home directory. But when I try to remove with with rm command I can not because given file is used by other processes. How can a find or list the processes which is opened or using this file? Thanks
The top or htop command is one way to see running programs. Use CTRL-C to close it.
[EDIT] top/htop shows running programs or processes, but it doesn't show what files are in use. A couple of other options that may be more what you are looking for are the fuser and lsof commands. See more details here and here.
There are a lot different ways to a process which is using given file. But fuser command can be used to list users who is using give n files. Fuser /home/john/test.txt will list processes wich opened test.txt file .
for more details: https://www.poftut.com/use-fuser-match-user-process/