
Heya. Anyone know of a tool that is like "top" but for showing the number of files a process has open. I know all about lsof. But I want something along the lines of: PID NAME OPENFILES 1234 httpd 20 5321 bash 5 ... Etc... Something I can sort by number of files open like you can sort top by memory or cpu usage. Anyone know of anything like this or knows how to get lsof and some grep/perl/awk filters to do something similar. Regards -- Oliver Jones » Director » oliver(a)deeperdesign.com » +64 (21) 41 2238 Deeper Design Limited » +64 (7) 377 3328 » www.deeperdesign.com

On Mon, 23 Aug 2004, Oliver Jones wrote:
Heya.
Anyone know of a tool that is like "top" but for showing the number of files a process has open. I know all about lsof. But I want something along the lines of:
PID NAME OPENFILES 1234 httpd 20 5321 bash 5 ...
Something I can sort by number of files open like you can sort top by memory or cpu usage.
You might be able to do something similar by traversing /proc/[1-9][0-9]*/ and doing some counts... it'd make for a fun scripting exercise :) Cheers Richard

On Mon, 2004-08-23 at 12:36, Oliver Jones wrote:
Heya.
Anyone know of a tool that is like "top" but for showing the number of files a process has open. I know all about lsof. But I want something along the lines of:
PID NAME OPENFILES 1234 httpd 20 5321 bash 5 ...
Etc...
Something I can sort by number of files open like you can sort top by memory or cpu usage.
Anyone know of anything like this or knows how to get lsof and some grep/perl/awk filters to do something similar.
Ok, you asked for it... (PS I think this looks a lot more readable than Perry's awk/uniq/sort/join/ps/sort/sort command-line monstrosity...) The PowerPC chip has a machine instruction for Ensure Inline Execution of I/O. The opcode is EIEIO. And you thought engineers had no sense of humour?

+c doesn't appear to be an option on RedHat 9's version of lsof On Mon, 2004-08-23 at 13:21, John McPherson wrote:
On Mon, 2004-08-23 at 12:36, Oliver Jones wrote:
Heya.
Anyone know of a tool that is like "top" but for showing the number of files a process has open. I know all about lsof. But I want something along the lines of:
PID NAME OPENFILES 1234 httpd 20 5321 bash 5 ...
Etc...
Something I can sort by number of files open like you can sort top by memory or cpu usage.
Anyone know of anything like this or knows how to get lsof and some grep/perl/awk filters to do something similar.
Ok, you asked for it...
(PS I think this looks a lot more readable than Perry's awk/uniq/sort/join/ps/sort/sort command-line monstrosity...)
The PowerPC chip has a machine instruction for Ensure Inline Execution of I/O. The opcode is EIEIO. And you thought engineers had no sense of humour?
______________________________________________________________________
_______________________________________________ wlug mailing list | wlug(a)list.waikato.ac.nz Unsubscribe: http://list.waikato.ac.nz/mailman/listinfo/wlug
-- Oliver Jones » Director » oliver(a)deeperdesign.com » +64 (21) 41 2238 Deeper Design Limited » +64 (7) 377 3328 » www.deeperdesign.com

Thank you for that. With a little tweaking it's doing exactly what I wanted (in combination with watch). I reversed the sort order (highest open file count first). And as previously mentioned RH9's lsof doesn't support +c 16. It doesn't print any output if you try and use that option. Regards
Ok, you asked for it...
(PS I think this looks a lot more readable than Perry's awk/uniq/sort/join/ps/sort/sort command-line monstrosity...)
The PowerPC chip has a machine instruction for Ensure Inline Execution of I/O. The opcode is EIEIO. And you thought engineers had no sense of humour?
-- Oliver Jones » Director » oliver(a)deeperdesign.com » +64 (21) 41 2238 Deeper Design Limited » +64 (7) 377 3328 » www.deeperdesign.com

On Mon, Aug 23, 2004 at 01:21:42PM +1200, John McPherson wrote:
The PowerPC chip has a machine instruction for Ensure Inline Execution of I/O. The opcode is EIEIO. And you thought engineers had no sense of humour?
and consequently an errormessage in hurd reads: "Computer bought the farm" http://lists.debian.org/debian-hurd/1999/05/msg00215.html greetings, martin. -- looking for a job doing pike programming, sTeam/caudium/pike/roxen training, sTeam/caudium/roxen and/or unix system administration anywhere in the world. -- pike programmer travelling and working in europe open-steam.org unix system- bahai.or.at iaeste.(tuwien.ac|or).at administrator (stuts|black.linux-m68k).org is.schon.org Martin Bähr http://www.iaeste.or.at/~mbaehr/

Oliver Jones wrote:
Anyone know of a tool that is like "top" but for showing the number of files a process has open. I know all about lsof. But I want something along the lines of:
PID NAME OPENFILES 1234 httpd 20 5321 bash 5 ...
Etc...
Something I can sort by number of files open like you can sort top by memory or cpu usage.
Anyone know of anything like this or knows how to get lsof and some grep/perl/awk filters to do something similar.
This is sort of what you want. The columns don't line up and it's not sorted, but it's a start. lsof | awk 'BEGIN{print "PID\tNAME\tOPEN FILES";} {x=$2"\t"$1; a[x]++;} END{for (x in a) print x"\t"a[x];}' Regards, Jon
participants (6)
-
A. Pagaltzis
-
John McPherson
-
Jonathan Purvis
-
Martin Bähr
-
Oliver Jones
-
Richard Stevenson