Categories
Command line Fu

Which files has a *nix process opened?

To list all files that are opened by a *nix process with a given pid, say 42, use the lsof command: (sudo) lsof -p 42 Of course, a process may have many files open. To list only files that have a name containing “log”, use the grep command: (sudo) lsof -p 42 | grep log […]