lsof(8) -Pnl %2BM -i4
list open files
-P       This option inhibits the conversion of port numbers to port names for network files.  Inhibiting
         the  conversion  may  make lsof run a little faster.  It is also useful when port name lookup is
         not working properly.
-n       This option inhibits the conversion  of  network  numbers  to  host  names  for  network  files.
         Inhibiting  conversion may make lsof run faster.  It is also useful when host name lookup is not
         working properly.
-l       This  option  inhibits the conversion of user ID numbers to login names.  It is also useful when
         login name lookup is working improperly or slowly.
names    These are path names of specific files to list.  Symbolic links are resolved  before  use.   The
         first name may be separated from the preceding options with the ``--'' option.

         If  a  name  is the mounted-on directory of a file system or the device of the file system, lsof
         will list all the files open on the file system.  To be considered a file system, the name  must
         match  a  mounted-on  directory  name  in  mount(8)  output, or match the name of a block device
         associated with a mounted-on directory name.  The +|-f option may  be  used  to  force  lsof  to
         consider a name a file system identifier (+f) or a simple file (-f).

         If  name is a path to a directory that is not the mounted-on directory name of a file system, it
         is treated just as a regular file is treated - i.e., its listing is restricted to processes that
         have  it  open as a file or as a process-specific directory, such as the root or current working
         directory.  To request that lsof look for open files inside a directory name, use the +d  s  and
         +D D options.

         If  a  name  is  the base name of a family of multiplexed files - e. g, AIX's /dev/pt[cs] - lsof
         will  list  all  the  associated  multiplexed  files  on  the  device  that  are  open  -  e.g.,
         /dev/pt[cs]/1, /dev/pt[cs]/2, etc.

         If a name is a UNIX domain socket name, lsof will usually search for it by the characters of the
         name alone - exactly as it is specified and is recorded in the kernel  socket  structure.   (See
         the next paragraph for an exception to that rule for Linux.)  Specifying a relative path - e.g.,
         ./file - in place of the file's absolute path - e.g., /tmp/file - won't work because  lsof  must
         match the characters you specify with what it finds in the kernel UNIX domain socket structures.

         If  a  name is a Linux UNIX domain socket name, in one case lsof is able to search for it by its
         device and inode number, allowing name to be a  relative  path.   The  case  requires  that  the
         absolute  path -- i.e., one beginning with a slash ('/') be used by the process that created the
         socket, and hence be stored in the /proc/net/unix file; and it requires that  lsof  be  able  to
         obtain  the  device  and  node  numbers of both the absolute path in /proc/net/unix and name via
         successful stat(2) system calls.  When those conditions are met, lsof will be able to search for
         the  UNIX domain socket when some path to it is is specified in name.  Thus, for example, if the
         path is /dev/log, and an lsof search is initiated when the working directory is /dev, then  name
         could be ./log.

         If  a name is none of the above, lsof will list any open files whose device and inode match that
         of the specified path name.

         If you have also specified the -b option, the only names you may safely specify are file systems
         for  which  your  mount table supplies alternate device numbers.  See the AVOIDING KERNEL BLOCKS
         and ALTERNATE DEVICE NUMBERS sections for more information.

         Multiple file names are joined  in  a  single  ORed  set  before  participating  in  AND  option
         selection.
-i [i]   This  option  selects  the  listing  of  files any of whose Internet address matches the address
         specified in i.  If no address is specified, this option selects the listing of all Internet and
         x.25 (HP-UX) network files.

                If  -i4  or  -i6 is specified with no following address, only files of the indicated IP version,
                IPv4 or IPv6, are displayed.  (An IPv6 specification may be used only if the  dialects  supports
                IPv6,  as  indicated  by  ``[46]''  and  ``IPv[46]''  in lsof's -h or -?  output.)  Sequentially
                specifying -i4, followed by -i6 is the same as specifying -i, and vice-versa.   Specifying  -i4,
                or -i6 after -i is the same as specifying -i4 or -i6 by itself.

                Multiple  addresses  (up  to a limit of 100) may be specified with multiple -i options.  (A port
                number or service name range is counted as one address.)  They are joined in a single  ORed  set
                before participating in AND option selection.

                An Internet address is specified in the form (Items in square brackets are optional.):

                [46][protocol][@hostname|hostaddr][:service|port]

                where:
                     46 specifies the IP version, IPv4 or IPv6
                          that applies to the following address.
                          '6' may be be specified only if the UNIX
                          dialect supports IPv6.  If neither '4' nor
                          '6' is specified, the following address
                          applies to all IP versions.
                     protocol is a protocol name - TCP, UDP
                     hostname is an Internet host name.  Unless a
                          specific IP version is specified, open
                          network files associated with host names
                          of all versions will be selected.
                     hostaddr is a numeric Internet IPv4 address in
                          dot form; or an IPv6 numeric address in
                          colon form, enclosed in brackets, if the
                          UNIX dialect supports IPv6.  When an IP
                          version is selected, only its numeric
                          addresses may be specified.
                     service is an /etc/services name - e.g., smtp -
                          or a list of them.
                     port is a port number, or a list of them.

                IPv6 options may be used only if the UNIX dialect supports IPv6.  To see if the dialect supports
                IPv6, run lsof and specify the -h or -?  (help) option.  If the displayed description of the  -i
                option contains ``[46]'' and ``IPv[46]'', IPv6 is supported.

                IPv4  host names and addresses may not be specified if network file selection is limited to IPv6
                with -i 6.  IPv6 host names and addresses may not be specified  if  network  file  selection  is
                limited  to  IPv4  with  -i  4.   When  an open IPv4 network file's address is mapped in an IPv6
                address, the open file's type will be IPv6, not IPv4, and its display will be selected  by  '6',
                not '4'.

                At  least  one address component - 4, 6, protocol, ,IR hostname , hostaddr, or service - must be
                supplied.  The `@' character, leading the host specification, is always required; as is the `:',
                leading  the  port  specification.  Specify either hostname or hostaddr.  Specify either service
                name list or port number list.  If a service name list is specified, the protocol may also  need
                to  be  specified  if  the TCP, UDP and UDPLITE port numbers for the service name are different.
                Use any case - lower or upper - for protocol.

                Service names and port numbers may be combined in a list whose entries are separated  by  commas
                and  whose numeric range entries are separated by minus signs.  There may be no embedded spaces,
                and all service names must belong to the specified protocol.  Since service  names  may  contain
                embedded  minus  signs,  the starting entry of a range can't be a service name; it can be a port
                number, however.

                Here are some sample addresses:

-i6 - IPv6 only
TCP:25 - TCP and port 25
@1.2.3.4 - Internet IPv4 host address 1.2.3.4
@[3ffe:1ebc::1]:1234 - Internet IPv6 host address
     3ffe:1ebc::1, port 1234
UDP:who - UDP who service port
TCP@lsof.itap:513 - TCP, port 513 and host name lsof.itap
tcp@foo:1-10,smtp,99 - TCP, ports 1 through 10,
     service name smtp, port 99, host name foo
tcp@bar:1-smtp - TCP, ports 1 through smtp, host bar
:time - either TCP, UDP or UDPLITE time service port
source manpages: lsof