"lsof -o" under Linux

Gerald Combs gerald at ethereal.com
Tue Nov 2 13:47:08 CST 2004


Jason Clinton wrote:

> I'm interested in knowing this as well. Some Googling hasn't turned up
> anything useful, so far. Just to be clear, you want to know what byte
> offset that a particular file descriptor for a particular process is
> sitting at, right?

Exactly.  If I'm waiting on tar to extract three files from the middle
of a multi-gigabyte archive, I want to know how far into the file  it is
so that I can adjust my patience level accordingly.  I was able to get
offsets for regular file descriptors, special devices (e.g. tape drives,
which is _really_ handy) and even sockets under Solaris 10 years ago.
What's taking Linux so long?

While we're on the subject, why doesn't "top" under Linux print I/O wait
statistics, like its Solaris counterpart does?  Have a look at the CPU
lines in the following:

Linux:

top - 13:41:07 up 69 days, 3:24, 1 user, load average: 0.10, 0.11, 0.12
Tasks: 260 total,   1 running, 259 sleeping,   0 stopped,   0 zombie
Cpu(s):   0.8% user,   3.1% system,   0.0% nice,  96.1% idle
Mem:   1550600k total,  1468416k used,    82184k free,        0k buffers
Swap:   996020k total,    66568k used,   929452k free,  1147744k cached


Solaris:

load averages:  0.32,  0.24,  0.23                           13:41:36
91 processes:  88 sleeping, 1 running, 2 on cpu
CPU states: 50.5% idle, 45.0% user, 4.4% kernel, 0.1% iowait, 0.0% swap
Memory: 512M real, 119M free, 757M swap in use, 1637M swap free

If the system is having performance problems, a high "iowait" tells me
at a glance if the problem is disk-bound vs CPU-bound.


More information about the Kclug mailing list