Lsof: Difference between revisions
m Copy edit. |
m Fixing the URL on a broken link that was removed 18:45, 8 February 2010 by Toddintr |
||
Line 63: | Line 63: | ||
== External links == |
== External links == |
||
* [http://www.netadmintools.com/html/lsof.man.html lsof manpage on www.netadmintools.com] |
* [http://www.netadmintools.com/html/lsof.man.html lsof manpage on www.netadmintools.com] |
||
* [http://www.digitalprognosis.com/linuxtips/troubleshooting-running-systems-with-lsof/ Troubleshooting Runnings Systems with lsof] |
|||
* Lsof FAQ [http://gd.tuwien.ac.at/utils/admin-tools/lsof/FAQ] |
* Lsof FAQ [http://gd.tuwien.ac.at/utils/admin-tools/lsof/FAQ] |
||
* Sam Nelson's [http://www.unix.ms/pcp/ PCP] script, an alternative to "lsof -i" for Solaris. |
* Sam Nelson's [http://www.unix.ms/pcp/ PCP] script, an alternative to "lsof -i" for Solaris. |
Revision as of 18:08, 11 April 2011
Developer(s) | Vic Abell |
---|---|
Stable release | 4.82
/ March 25, 2009 |
Repository | |
License | BSD license-compatible[1] |
Website | http://people.freebsd.org/~abe/ |
lsof is a command meaning "list open files", which is used in many Unix-like systems to report a list of all open files and the processes that opened them. This open source utility was developed and supported by Vic Abell, the retired Associate Director of the Purdue University Computing Center. It works in and supports several Unix flavors.[2]
Open files in the system include disk files, pipes, network sockets and devices opened by all processes. One use for this command is when a disk cannot be unmounted because (unspecified) files are in use. The listing of open files can be consulted (suitably filtered if necessary) to identify the process that is using the files.
# lsof /var
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
syslogd 350 root 5w VREG 222,5 0 440818 /var/adm/messages
syslogd 350 root 6w VREG 222,5 339098 6248 /var/log/syslog
cron 353 root cwd VDIR 222,5 512 254550 /var -- atjobs
To view the port associated with a daemon:
# lsof -i -n -P | grep sendmail
sendmail 31649 root 4u IPv4 521738 TCP *:25 (LISTEN)
From the above we can see that "sendmail" is listening on its standard port of "25".
- -i Lists IP sockets.
- -n Do not resolve hostnames (no DNS).
- -P Do not resolve port names (list port number instead of its name).
See also
- stat (Unix)
- netstat
- strace
- List of Unix programs
- Process Explorer from SysInternals - the equivalent for Windows (Find menu -> Find Handle or DLL)
References
- ^ lsof FAQ, 1.9 Is there an lsof license?
- ^ W. Richard Stevens, Bill Fenner, Andrew M. Rudoff (2003), Unix Network Programming: the Sockets networking API, Addison-Wesley Professional, ISBN 9780131411555, ISBN 0131411551
{{citation}}
: CS1 maint: multiple names: authors list (link)
External links
- lsof manpage on www.netadmintools.com
- Troubleshooting Runnings Systems with lsof
- Lsof FAQ [1]
- Sam Nelson's PCP script, an alternative to "lsof -i" for Solaris.