EDIT 1
I’m having problems using the arguments given. Maybe it is the way I’m passing my arguments through NSTask? Any suggestions as to how I can do this?
NSTask *file_Task = [NSTask new];
[file_Task setLaunchPath:@"/usr/sbin/lsof"];
[file_Task setArguments:[NSArray arrayWithObjects:@"+p", the_Pid, nil]];
Good Afternoon Fellow Coders….
I’m using the following command:
lsof +p 13812
to get the list of a files accessed by a process. The thing is it is giving me a lot of additional information that I don’t want such as TYPE, DEVICE, etc.
Is there an argument that I can add to the above command so that I get ONLY the NAME?
Thank you, thank you thank you! 🙂
Eric
You can use:
This will output a list of lines, with the first being
pfollowed by the process ID,and all following lines consisting of
nfollowed by the file name.If you’d like to quickly preprocess this, you can do something similar to the following:
See the
lsofman page for more information, specifically under theOUTPUT FOR OTHER PROGRAMSheading.