Projects / lsof


Lsof is a Unix-specific diagnostic tool. Its name stands for LiSt Open Files, and it does just that. It lists information about any files that are open by processes currently running on the system. It can also list communications open by each process.

Recent releases

  •  19 Jul 2009 16:43

    Release Notes: This release corrects an over-zealous test that caused lsof to produce no ouput. A Solaris include/compilation problem and several compilation warnings were resolved. Many other Solaris and FreeBSD updates were made. Changes to Darwin lsof supplied by Apple were incorporated.

    •  30 Oct 2008 05:56

      Release Notes: This release updates the Darwin libproc sources; changes dummy declarations in the lib source file; adds support for Linux /proc/net/packet files; improves socket file only processing for Linux and PSTAT-based HP-UX; adds an htonl call around INADDR_LOOPBACK usage; adjusts for a change in FreeBSD 8.0 device number handling; adds -i speed improvements for AIX, Darwin, FreeBSD, PSTAT-based HP-UX, Linux, and Solaris; fixes a PSTAT-based HP-UX 11.31 stat(2) problem; adjusts for kernel header file changes in FreeBSD 8.0-CURRENT; and adds a Solaris VxFS warning, where appropriate.

      •  03 Sep 2008 22:47

        Release Notes: Adjustments to a change in FreeBSD 6.0 and above byte level locking have been made. Warnings for unsupported dialects or versions are issued. The Linux UDPLITE protocol is supported. A missing quote in the FreeBSD Configure stanza has been added. The usage.o rule in the HP-UX PSTAT-based Makefile has been restored.

        •  13 Nov 2004 00:59

          No changes have been submitted for this release.

          •  22 Mar 2004 11:06

            Release Notes: Text file support for Apple Darwin, a "-x [fl]" cross-over option, the optional reporting of socket options, and a "-z [z]" option for Solaris 10 were added. The UnixWare 7.1.4 support was updated.

            Recent comments

            21 Oct 2009 11:51 gdegoulet

            patch to see full cmdline when +c0 (lsof_4.82)

            --- dialects/linux/dproc.c 2008-10-21 18:17:25.000000000 +0200
            +++ dialects/linux/ 2009-10-21 13:48:17.000000000 +0200
            @@ -166,6 +166,7 @@
            static char *pidpath = (char *)NULL;
            static MALLOC_S pidpathl = 0;
            static MALLOC_S pidx = 0;
            + char nmabuf[MAXPATHLEN + 1], pbuf[MAXPATHLEN + 1];
            static DIR *ps = (DIR *)NULL;
            static char *taskpath = (char *)NULL;
            static int taskpathl = 0;
            @@ -278,12 +279,26 @@
            (void) make_proc_path(pidpath, n, &path, &pathl, "stat");
            rv = read_id_stat(0, path, pid, &cmd, &ppid, &pgid);
            + /*gd: override cmd if +c0 */
            + if (CmdLim == 0)
            + {
            + (void) make_proc_path(pidpath, n, &path, &pathl, "exe");
            + if (getlinksrc(path, pbuf, sizeof(pbuf)) < 1) { /*not a link, very strange .. nothing to do*/ }
            + else { cmd=pbuf; }
            + }
            + /*restoring initial path*/
            + (void) make_proc_path(pidpath, n, &path, &pathl, "stat");
            if (rv == 1)
            else if (rv == 0) {
            (void) process_id(pidpath, n, cmd, uid, pid, ppid, pgid);
            * The process is a zombie. Check for a non-zombie task.

            21 Oct 2009 10:17 gdegoulet

            feature request for linux : it could be nice to see the command with its real full path.
            the command is actualy grabbed from the /proc/pid/stat but you can simply do a readlink from /proc/pid/exe ?
            maybe can we have an option (-C) to change the output of the command ? (need to override the CMDL from lsof.h)


            08 Jun 2009 10:31 iza_cutie

            I have missed to type there the url of the article:


            08 Jun 2009 10:29 iza_cutie

            I saw this article saying "lsof for version for AMD 64-bit processors with the 64-bit Solaris 10 kernel is being worked on."

            I have this problem where i get this:

            # lsof
            lsof: FATAL: lsof was compiled for a 32 bit kernel,
            but this machine has booted a 64 bit kernel.

            Below is my machine info:

            # isainfo
            amd64 i386
            # isainfo -v
            64-bit amd64 applications
            sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8
            tsc fpu
            32-bit i386 applications
            sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8
            tsc fpu
            # isainfo -b

            lsof version used: lsof_4.78.tar.gz

            gcc=gcc version 3.4.4
            cc=cc: Sun C 5.8 2005/10/13

            Can I confirm with you if lsof_4.78 for version for AMD 64-bit processors with the 64-bit Solaris 10 kernel is not working yet too?

            If the answer is no, can you suggest, what I should do to correct the error?

            13 May 2002 19:19 Raboo

            nice work
            lsof is great, thanks ;)

            Keep the good work up.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.