Well, lsof does work on multiple operating systems including Linux and Solaris. For example, lsof revision 4.74 lists information about files opened by processes for the following UNIX dialects:
Apple Darwin 6.x and 7.x for Power Macintosh systems
BSDI BSD/OS 4.3.1 for x86-based systems
DEC OSF/1, Digital UNIX, Tru64 UNIX 4.0, and 5.1
FreeBSD 4.[2-9], 4.1, 5. and 6.0 for x86-based systems
FreeBSD 5. and 6.0 for Alpha, AMD64 and Sparc64 based systems
HP-UX 11.00 and 11.11
Linux 2.1.72 and above for x86-based systems
NetBSD 1. and 2.x for Alpha, x86, and SPARC-based systems
NEXTSTEP 3. for NEXTSTEP architectures
OpenBSD 2. and 3. for x86-based systems
Caldera OpenUNIX 8
SCO OpenServer Release 5.0.6 for x86-based systems
SCO|Caldera UnixWare 7.1.4 for x86-based systems
Solaris 2.6, 8, 9 and 10
The path to where lsof is installed my vary slightly but you can modify your code to pick the right one depending on which OS you are on at the time. So McDarren's example should give you what you need.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||