Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

There's a bzip2 process running in the background and I have no idea where it came from. It's eating up a lot of resources. Can I do a reverse lsof to see which files are being accessed by this process?

I've suspended the process for the time being.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

I'm not sure why that'd be a "reverse lsof" -- lsof does exactly that. You can pass it the -p flag to specify which PIDs to include/exclude in the results:

$ lsof -p $(pidof bzip2)
share|improve this answer
    
Reverse from lsof /path/to/file (which I guess is the mode of operation Pieter is used to). –  Gilles Sep 30 '11 at 23:35
add comment

In the /proc/ directory you can find details of the running processes, in separate directories, by their PID. Their file descriptors are enumerated in the fd/ sub-directory:

ls -l /proc/$(pidof -s bzip2)/fd/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.