Using lsof

From: Alistair McKeown (Alistair.McKeown@jacobsrimell.com)
Date: Mon Jan 22 2007 - 04:38:34 EST


HI there,

I've installed "lsof" from the sunfreeware site ,

-bash-3.00$ /usr/local/bin/lsof -h
lsof 4.74

What I'm trying to do is match a port number from a netstat to a
process. This should be possible using lsof, but I can't seem to get the
format right.

I type in :

/usr/local/bin/lsof -i :7101

Yet nothing comes back.

>From the command help it says :

  -i i select by IPv[46] address:
[46][proto][@host|addr][:svc_list|port_list]

But I just can't seem to get it right.

-bash-3.00$ /usr/local/bin/lsof -h
lsof 4.74
 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
 latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
 latest man page:
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
 usage: [-?abhlnNoOPRstUvV] [+|-c c] [+|-d s] [+|-D D] [+|-f[cfgGn]]
 [-F [f]] [-g [s]] [-i [i]] [-k k] [+|-L [l]] [-m m] [+|-M] [-o [o]]
[-p s] [+|-r [t]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [-z [z]]
[--] [names]
Defaults in parentheses; comma-separate set (s) items; dash-separate
ranges.
  -?|-h list help -a AND selections (OR) -b avoid kernel
blocks
  -c c cmd c, /c/[bix] +c w COMMAND width (9)
  +d s dir s files -d s select by FD set +D D dir D tree
*SLOW?*
  -D D ?|i|b|r|u[path] -i select IPv[46] files -l list UID
numbers
  -n no host names -N select NFS files -o list file
offset
  -O avoid overhead *RISK -P no port names -R list paRent PID
  -s list file size -t terse listing -T disable TCP/TPI
info
  -U select Unix socket -v list version info -V verbose search
  +|-w Warnings (+) -z z zone [z] -- end option scan
  +f|-f +filesystem or -file names +|-f[cfgGn] Ct,Fstr,flaGs,Node
  -F [f] select fields; -F? for help -k k kernel symbols
(/dev/ksyms)
  +|-L [l] list (+) suppress (-) link counts < l (0 = all; default = 0)
  -m m kernel memory (/dev/mem)
  +|-M portMap registration (-) -o o o 0t offset digits (8)
  -p s select by PID set -S [t] t second stat timeout
(15)
  -T fqsw TCP/TPI Fl,Q,St,Win (s) info
  -g [s] select by process group ID set and print process group IDs
  -i i select by IPv[46] address:
[46][proto][@host|addr][:svc_list|port_list]
  +|-r [t] repeat every t seconds (15); + until no files, - forever
  -u s exclude(^)|select login|UID set s
  -x [fl] cross over +d|+D File systems or symbolic Links
  names select named files or files on named file systems
Anyone can list all files; /dev warnings enabled; kernel ID check
enabled.
/u01/appl/bea/.lsof_viepapsro10 is the default device cache file read
path.
Any help apprecicated.

Regards,

Alistair.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:41:30 EDT