{
    "mode": "man",
    "parameter": "lsof",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/lsof/8/json",
    "generated": "2026-10-26T12:36:00Z",
    "synopsis": "lsof  [  -?abChlnNOPQRtUvVX  ]  [ -A A ] [ -c c ] [ +c c ] [ +|-d d ] [ +|-D D ] [ +|-e s ] [\n+|-E ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [ -K k ] [  +|-L  [l]  ]  [\n+|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t[m<fmt>]] ] [ -s [p:s] ] [ -S [t] ] [ -T [t] ]\n[ -u s ] [ +|-w ] [ -x [fl] ] [ -z [z] ] [ -Z [Z] ] [ -- ] [names]",
    "sections": {
        "NAME": {
            "content": "lsof - list open files\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "lsof  [  -?abChlnNOPQRtUvVX  ]  [ -A A ] [ -c c ] [ +c c ] [ +|-d d ] [ +|-D D ] [ +|-e s ] [\n+|-E ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [ -K k ] [  +|-L  [l]  ]  [\n+|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t[m<fmt>]] ] [ -s [p:s] ] [ -S [t] ] [ -T [t] ]\n[ -u s ] [ +|-w ] [ -x [fl] ] [ -z [z] ] [ -Z [Z] ] [ -- ] [names]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Lsof  revision  4.95.0  lists  on  its standard output file information about files opened by\nprocesses for the following UNIX dialects:\n\nApple Darwin 9 and Mac OS X 10.[567]\nFreeBSD 8.[234], 9.0 and 1[012].0 for AMD64-based systems\nLinux 2.1.72 and above for x86-based systems\nSolaris 9, 10 and 11\n\n(See the DISTRIBUTION section of this manual page for information on how to obtain the latest\nlsof revision.)\n\nAn open file may be a regular file, a directory, a block special file,  a  character  special\nfile,  an  executing  text reference, a library, a stream or a network file (Internet socket,\nNFS file or UNIX domain socket.)  A specific file or all the files in a file  system  may  be\nselected by path.\n\nInstead  of  a  formatted  display, lsof will produce output that can be parsed by other pro‐\ngrams.  See the -F, option description, and the OUTPUT FOR OTHER PROGRAMS  section  for  more\ninformation.\n\nIn  addition to producing a single output list, lsof will run in repeat mode.  In repeat mode\nit will produce output, delay, then repeat the output operation until stopped with an  inter‐\nrupt or quit signal.  See the +|-r [t[m<fmt>]] option description for more information.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "In the absence of any options, lsof lists all open files belonging to all active processes.\n\nIf any list request option is specified, other list requests must be specifically requested -\ne.g.,  if -U is specified for the listing of UNIX socket files, NFS files won't be listed un‐\nless -N is also specified; or if a user list is specified with the  -u  option,  UNIX  domain\nsocket  files,  belonging  to  users not in the list, won't be listed unless the -U option is\nalso specified.\n\nNormally, list options that are specifically stated are ORed - i.e., specifying the -i option\nwithout an address and the -ufoo option produces a listing of all network files OR files  be‐\nlonging to processes owned by user ``foo''.  The exceptions are:\n\n1) the `^' (negated) login name or user ID (UID), specified with the -u option;\n\n2) the `^' (negated) process ID (PID), specified with the -p option;\n\n3) the `^' (negated) process group ID (PGID), specified with the -g option;\n\n4) the `^' (negated) command, specified with the -c option;\n\n5) the (`^') negated TCP or UDP protocol state names, specified with the -s [p:s] option.\n\nSince they represent exclusions, they are applied without ORing or ANDing and take effect be‐\nfore any other selection criteria are applied.\n\nThe  -a  option may be used to AND the selections.  For example, specifying -a, -U, and -ufoo\nproduces a listing of only UNIX socket files that belong to processes owned by user ``foo''.\n\nCaution: the -a option causes all list selection options to be ANDed; it  can't  be  used  to\ncause  ANDing  of selected pairs of selection options by placing it between them, even though\nits placement there is acceptable.  Wherever -a is placed, it causes the ANDing of all selec‐\ntion options.\n\nItems of the same selection set - command names, file descriptors, network addresses, process\nidentifiers, user identifiers, zone names, security contexts - are joined in  a  single  ORed\nset  and  applied  before  the  result participates in ANDing.  Thus, for example, specifying",
            "subsections": [
                {
                    "name": "-i -i -a -u",
                    "content": "ther login ``fff'' OR ``ggg'' AND have network connections to either host aaa.bbb OR ccc.ddd.\n\nOptions may be grouped together following a single prefix -- e.g., the  option  set  ``-a  -b",
                    "flag": "-u"
                },
                {
                    "name": "-C -abC -F -g -i",
                    "content": "+|-L, -o, +|-r, -s, -S, -T, -x and -z.  when you have no values for them be careful that  the\nfollowing character isn't ambiguous.  For example, -Fn might represent the -F and -n options,\nor it might represent the n field identifier character following the -F option.  When ambigu‐\nity  is possible, start a new option with a `-' character - e.g., ``-F -n''.  If the next op‐\ntion is a file name, follow the possibly ambiguous option with ``--'' - e.g., ``-F -- name''.\n\nEither the `+' or the `-' prefix may be applied to a group of options.   Options  that  don't\ntake  on  separate  meanings for each prefix - e.g., -i - may be grouped under either prefix.\nThus, for example, ``+M -i'' may be stated as ``+Mi'' and the group means  the  same  as  the\nseparate  options.   Be careful of prefix grouping when one or more options in the group does\ntake on separate meanings under different prefixes - e.g., +|-M; ``-iM'' is not the same  re‐\nquest as ``-i +M''.  When in doubt, use separate options with appropriate prefixes.\n\n-? -h    These  two  equivalent  options  select a usage (help) output list.  Lsof displays a\nshortened form of this output when it detects an error in the  options  supplied  to\nit,  after it has displayed messages explaining each error.  (Escape the `?' charac‐\nter as your shell requires.)\n",
                    "flag": "-i"
                },
                {
                    "name": "-a",
                    "content": "",
                    "flag": "-a"
                },
                {
                    "name": "-A _",
                    "content": "dynamic  modules.   It  allows  the lsof user to specify A as an alternate name list\nfile where the kernel addresses of the dynamic modules might be found.  See the lsof\nFAQ (The FAQ section gives its location.)  for more information about  dynamic  mod‐\nules, their symbols, and how they affect lsof.\n",
                    "flag": "-A"
                },
                {
                    "name": "-b",
                    "content": "stat(2).\n\nSee the BLOCKS AND TIMEOUTS and AVOIDING KERNEL BLOCKS sections for  information  on\nusing this option.\n",
                    "flag": "-b"
                },
                {
                    "name": "-c _",
                    "content": "the characters of c.  Multiple commands may be specified, using multiple -c options.\nThey are joined in a single ORed set before participating in AND option selection.\n\nIf c begins with a `^', then the following characters specify a command  name  whose\nprocesses are to be ignored (excluded.)\n\nIf  c begins and ends with a slash ('/'), the characters between the slashes are in‐\nterpreted as a regular expression.  Shell meta-characters in the regular  expression\nmust  be quoted to prevent their interpretation by the shell.  The closing slash may\nbe followed by these modifiers:\n\nb    the regular expression is a basic one.\ni    ignore the case of letters.\nx    the regular expression is an extended one\n(default).\n\nSee the lsof FAQ (The FAQ section gives its location.)  for more information on  ba‐\nsic and extended regular expressions.\n\nThe  simple  command specification is tested first.  If that test fails, the command\nregular expression is applied.  If the simple command  test  succeeds,  the  command\nregular  expression  test  isn't  made.   This  may result in ``no command found for\nregex:'' messages when lsof's -V option is specified.\n\n+c w     defines the maximum number of initial characters of the name, supplied by  the  UNIX\ndialect,  of the UNIX command associated with a process to be printed in the COMMAND\ncolumn.  (The lsof default is nine.)\n\nNote that many UNIX dialects do not supply all command name characters  to  lsof  in\nthe files and structures from which lsof obtains command name.  Often dialects limit\nthe  number  of characters supplied in those sources.  For example, Linux 2.4.27 and\nSolaris 9 both limit command name length to 16 characters.\n\nIf w is zero ('0'), all command characters supplied to lsof by the UNIX dialect will\nbe printed.\n\nIf w is less than the length of the column title, ``COMMAND'', it will be raised  to\nthat length.\n",
                    "flag": "-c"
                },
                {
                    "name": "-C",
                    "content": "See the KERNEL NAME CACHE section for more information.\n\n+d s     causes lsof to search for all open instances of directory s and the files and direc‐\ntories it contains at its top level.  +d does NOT descend the directory tree, rooted\nat s.  The +D D option may be used to request a full-descent directory tree  search,\nrooted at directory D.\n\nProcessing of the +d option does not follow symbolic links within s unless the -x or\n-x   l  option  is also specified.  Nor does it search for open files on file system\nmount points on subdirectories of s unless the -x or -x  f option is also specified.\n\nNote: the authority of the user of this option limits it to searching for files that\nthe user has permission to examine with the system stat(2) function.\n",
                    "flag": "-C"
                },
                {
                    "name": "-d _",
                    "content": "listing.   The  file  descriptors are specified in the comma-separated set s - e.g.,\n``cwd,1,3'', ``^6,^2''.  (There should be no spaces in the set.)\n\nThe list is an exclusion list if all entries of the set begin with `^'.   It  is  an\ninclusion list if no entry begins with `^'.  Mixed lists are not permitted.\n\nA file descriptor number range may be in the set as long as neither member is empty,\nboth  members  are  numbers, and the ending member is larger than the starting one -\ne.g., ``0-7'' or ``3-10''.  Ranges may be specified for exclusion if they  have  the\n`^' prefix - e.g., ``^0-7'' excludes all file descriptors 0 through 7.\n\nMultiple  file descriptor numbers are joined in a single ORed set before participat‐\ning in AND option selection.\n\nWhen there are exclusion and inclusion members in the set, lsof reports them as  er‐\nrors and exits with a non-zero return code.\n\nSee  the description of File Descriptor (FD) output values in the OUTPUT section for\nmore information on file descriptor names.\n\nfd is a pseudo file descriptor name for specifying the whole range of possible  file\ndescriptor numbers.  fd does not appear in FD column of output.\n\n+D D     causes  lsof  to  search for all open instances of directory D and all the files and\ndirectories it contains to its complete depth.\n\nProcessing of the +D option does not follow symbolic links within D unless the -x or\n-x  l option is also specified.  Nor does it search for open files  on  file  system\nmount points on subdirectories of D unless the -x or -x  f option is also specified.\n\nNote: the authority of the user of this option limits it to searching for files that\nthe user has permission to examine with the system stat(2) function.\n\nFurther  note: lsof may process this option slowly and require a large amount of dy‐\nnamic memory to do it.  This is because it must descend the entire  directory  tree,\nrooted at D, calling stat(2) for each file and directory, building a list of all the\nfiles  it finds, and searching that list for a match with every open file.  When di‐\nrectory D is large, these steps can take a long time, so use this option prudently.\n",
                    "flag": "-d"
                },
                {
                    "name": "-D _",
                    "content": "restricted.   See  the DEVICE CACHE FILE section and the sections that follow it for\nmore information on this option.\n\n-D must be followed by a function letter; the function letter may optionally be fol‐\nlowed by a path name.  Lsof recognizes these function letters:\n\n? - report device cache file paths\nb - build the device cache file\ni - ignore the device cache file\nr - read the device cache file\nu - read and update the device cache file\n\nThe b, r, and u functions, accompanied by a path  name,  are  sometimes  restricted.\nWhen  these functions are restricted, they will not appear in the description of the\n-D option that accompanies -h or -?  option output.  See the DEVICE CACHE FILE  sec‐\ntion  and  the  sections  that follow it for more information on these functions and\nwhen they're restricted.\n\nThe ?  function reports the read-only and write paths that lsof can use for the  de‐\nvice cache file, the names of any environment variables whose values lsof will exam‐\nine  when forming the device cache file path, and the format for the personal device\ncache file path.  (Escape the `?' character as your shell requires.)\n\nWhen available, the b, r, and u functions may be followed by the device cache file's\npath.  The standard default is .lsofhostname in the home directory of the real user\nID that executes lsof, but this could have been changed when lsof was configured and\ncompiled.  (The output of the -h and -?  options show the current default  prefix  -\ne.g.,  ``.lsof''.)   The suffix, hostname, is the first component of the host's name\nreturned by gethostname(2).\n\nWhen available, the b function directs lsof to build a new device cache file at  the\ndefault or specified path.\n\nThe  i  function directs lsof to ignore the default device cache file and obtain its\ninformation about devices via direct calls to the kernel.\n\nThe r function directs lsof to read the device cache at  the  default  or  specified\npath,  but prevents it from creating a new device cache file when none exists or the\nexisting one is improperly structured.  The r function,  when  specified  without  a\npath  name,  prevents lsof from updating an incorrect or outdated device cache file,\nor creating a new one in its place.  The r function is always available when  it  is\nspecified  without  a path name argument; it may be restricted by the permissions of\nthe lsof process.\n\nWhen available, the u function directs lsof to read the device cache file at the de‐\nfault or specified path, if possible, and to rebuild it, if necessary.  This is  the\ndefault device cache file function when no -D option has been specified.\n\n+|-e s   exempts the file system whose path name is s from being subjected to kernel function\ncalls  that  might  block.   The  +e option exempts stat(2), lstat(2) and most read‐\nlink(2) kernel function calls.  The -e option exempts only stat(2) and lstat(2) ker‐\nnel function calls.  Multiple file systems may be specified with separate +|-e spec‐\nifications and each may have readlink(2) calls exempted or not.\n\nThis option is currently implemented only for Linux.\n\nCAUTION: this option can easily be mis-applied to other than the file system of  in‐\nterest,  because  it  uses  path name rather than the more reliable device and inode\nnumbers.  (Device and inode  numbers  are  acquired  via  the  potentially  blocking\nstat(2)  kernel call and are thus not available, but see the +|-m m option as a pos‐\nsible alternative way to supply device numbers.)  Use this option  with  great  care\nand fully specify the path name of the file system to be exempted.\n\nWhen open files on exempted file systems are reported, it may not be possible to ob‐\ntain  all their information.  Therefore, some information columns will be blank, the\ncharacters ``UNKN'' preface the values in the TYPE column, and the applicable exemp‐\ntion option is added in parentheses to the end of the  NAME  column.   (Some  device\nnumber information might be made available via the +|-m m option.)\n\n+|-E     +E  specifies  that  Linux pipe, Linux UNIX socket, Linux INET(6) socket closed in a\nlocal host, Linux pseudoterminal files,  POSIX  Message  Queueue  implementation  in\nLinux, and Linux eventfd should be displayed with endpoint information and the files\nof the endpoints should also be displayed.\n\nNote  1:  UNIX  socket  file endpoint information is only available when the compile\nflags line of -v output contains HASUXSOCKEPT, and psudoterminal  endpoint  informa‐\ntion is only available when the compile flags line contains HASPTYEPT.\n\nNote  2: POSIX Message Queue file endpoint information is only available when mqueue\nfile system is mounted.\n\nPipe endpoint information is displayed in the NAME column in the form  ``PID,cmd,FD‐\nmode'',  where  PID is the endpoint process ID; cmd is the endpoint process command;\nFD is the endpoint file's descriptor; and mode is the endpoint file's access mode.\n\nPseudoterminal  endpoint  information  is  displayed   in   the   NAME   column   as\n``->/dev/ptsmin PID,cmd,FDmode''  or  ``PID,cmd,FDmode''.   The  first form is for a\nmaster device; the second, for a slave device.  min is a slave device's minor device\nnumber; and PID, cmd, FD and mode are the same as with  pipe  endpoint  information.\nNote:  psudoterminal  endpoint  information is only available when the compile flags\nline of -V output contains HASPTYEPT. In addition, this feature works on Linux  ker‐\nnels above 4.13.0.\n\nUNIX socket file endpoint information is displayed in the NAME column in the form\n``type=TYPE ->INO=INODE PID,cmd,FDmode'',  where  TYPE  is the socket type; INODE is\nthe i-node number of the connected socket; and PID, cmd, FD and mode are the same as\nwith pipe endpoint information.  Note: UNIX  socket  file  endpoint  information  is\navailable only when the compile flags line of -v output contains HASUXSOCKEPT.\n\nINET socket file endpoint information is inserted to the value at the NAME column in\nth form\nPID,  cmd,  FD and mode are the same as with pipe endpoint information. The endpoint\ninformation is available only if the socket is used for local  IPC;  both  endpoints\nbind to the same local IPv4 or IPv6 address.\n\nPOSIX Message Queue file endpoint information is displayed in the NAME column in the\nsame form as that of pipe.\n\neventfd  endpoint  information  is  displayed in the NAME column in the same form as\nthat of pipe. This feature works on Linux kernels above 5.2.0.\n\nMultiple occurrences of this information can appear in a file's NAME column.\n\n-E specifies that endpoint supported files should be displayed with endpoint  infor‐\nmation, but not the files of the endpoints.\n",
                    "flag": "-D"
                },
                {
                    "name": "+|-f [cfgGn]",
                    "content": "f  by itself clarifies how path name arguments are to be interpreted.  When followed\nby c, f, g, G, or n in any combination it specifies that the listing of kernel  file\nstructure information is to be enabled (`+') or inhibited (`-').\n\nNormally  a  path  name  argument  is taken to be a file system name if it matches a\nmounted-on directory name reported by mount(8), or if it represents a block  device,\nnamed  in the mount output and associated with a mounted directory name.  When +f is\nspecified, all path name arguments will be taken to be file system names,  and  lsof\nwill complain if any are not.  This can be useful, for example, when the file system\nname  (mounted-on  device)  isn't a block device.  This happens for some CD-ROM file\nsystems.\n\nWhen -f is specified by itself, all path name arguments will be taken to  be  simple\nfiles.   Thus, for example, the ``-f -- /'' arguments direct lsof to search for open\nfiles with a `/' path name, not all open files in the `/' (root) file system.\n\nBe careful to make sure +f and -f are properly terminated and aren't followed  by  a\ncharacter  (e.g.,  of the file or file system name) that might be taken as a parame‐\nter.  For example, use ``--'' after +f and -f as in these examples.\n\n$ lsof +f -- /file/system/name\n$ lsof -f -- /file/name\n\nThe listing of information from  kernel  file  structures,  requested  with  the  +f\n[cfgGn]  option  form,  is normally inhibited, and is not available in whole or part\nfor some dialects - e.g., /proc-based Linux kernels below 2.6.22.  When  the  prefix\nto f is a plus sign (`+'), these characters request file structure information:\n\nc    file structure use count (not Linux)\nf    file structure address (not Linux)\ng    file flag abbreviations (Linux 2.6.22 and up)\n\nAbbrev.   Flag in C code (see open(2))\n\nW         OWRONLY\nRW        ORDWR\nCR        OCREAT\nEXCL      OEXCL\nNTTY      ONOCTTY\nTR        OTRUNC\nAP        OAPPEND\nND        ONDELAY\nSYN       OSYNC\nASYN      OASYNC\nDIR       ODIRECT\nDTY       ODIRECTORY\nNFLK      ONOFOLLOW\nNATM      ONOATIME\nDSYN      ODSYNC\nRSYN      ORSYNC\nLG        OLARGEFILE\nCX        OCLOEXEC\nTMPF      OTMPFILE\n\nG    file flags in hexadecimal (Linux 2.6.22 and up)\nn    file structure node address (not Linux)\n\nWhen  the prefix is minus (`-') the same characters disable the listing of the indi‐\ncated values.\n\nFile structure addresses, use counts, flags, and node addresses may be used  to  de‐\ntect  more  readily identical files inherited by child processes and identical files\nin use by different processes.  Lsof column output can be sorted by  output  columns\nholding  the  values and listed to identify identical file use, or lsof field output\ncan be parsed by an AWK or Perl post-filter script, or by a C program.\n"
                },
                {
                    "name": "-F _",
                    "content": "by another program, and the character that terminates each output field.  Each field\nto  be  output  is specified with a single character in f.  The field terminator de‐\nfaults to NL, but may be changed to NUL (000).  See the OUTPUT  FOR  OTHER  PROGRAMS\nsection  for a description of the field identification characters and the field out‐\nput process.\n\nWhen the field selection character list is empty, all standard fields  are  selected\n(except the raw device field, security context and zone field for compatibility rea‐\nsons) and the NL field terminator is used.\n\nWhen  the  field selection character list contains only a zero (`0'), all fields are\nselected (except the raw device field for compatibility reasons) and the NUL  termi‐\nnator character is used.\n\nOther combinations of fields and their associated field terminator character must be\nset  with  explicit entries in f, as described in the OUTPUT FOR OTHER PROGRAMS sec‐\ntion.\n\nWhen a field selection character identifies an item lsof does not  normally  list  -\ne.g.,  PPID, selected with -R - specification of the field character - e.g., ``-FR''\n- also selects the listing of the item.\n\nWhen the field selection character list contains the single character `?', lsof will\ndisplay a help list of the field identification characters.  (Escape the `?' charac‐\nter as your shell requires.)\n",
                    "flag": "-F"
                },
                {
                    "name": "-g _",
                    "content": "group IDentification (PGID) numbers are in the comma-separated set s - e.g., ``123''\nor ``123,^456''.  (There should be no spaces in the set.)\n\nPGID numbers that begin with `^' (negation) represent exclusions.\n\nMultiple  PGID  numbers  are joined in a single ORed set before participating in AND\noption selection.  However, PGID exclusions are applied without ORing or ANDing  and\ntake effect before other selection criteria are applied.\n\nThe -g option also enables the output display of PGID numbers.  When specified with‐\nout a PGID set that's all it does.\n",
                    "flag": "-g"
                },
                {
                    "name": "-i _",
                    "content": "ified  in i.  If no address is specified, this option selects the listing of all In‐\nternet and x.25 (HP-UX) network files.\n\nIf -i4 or -i6 is specified with no following address, only files of the indicated IP\nversion, IPv4 or IPv6, are displayed.  (An IPv6 specification may be  used  only  if\nthe dialects supports IPv6, as indicated by ``[46]'' and ``IPv[46]'' in lsof's -h or\n-?  output.)  Sequentially specifying -i4, followed by -i6 is the same as specifying\n-i,  and  vice-versa.  Specifying -i4, or -i6 after -i is the same as specifying -i4\nor -i6 by itself.\n\nMultiple addresses (up to a limit of 100) may be specified with multiple -i options.\n(A port number or service name range is counted as one address.)  They are joined in\na single ORed set before participating in AND option selection.\n\nAn Internet address is specified in the form  (Items  in  square  brackets  are  op‐\ntional.):\n\n[46][protocol][@hostname|hostaddr][:service|port]\n\nwhere:\n46 specifies the IP version, IPv4 or IPv6\nthat applies to the following address.\n'6' may be be specified only if the UNIX\ndialect supports IPv6.  If neither '4' nor\n'6' is specified, the following address\napplies to all IP versions.\nprotocol is a protocol name - TCP, UDP\nhostname is an Internet host name.  Unless a\nspecific IP version is specified, open\nnetwork files associated with host names\nof all versions will be selected.\nhostaddr is a numeric Internet IPv4 address in\ndot form; or an IPv6 numeric address in\ncolon form, enclosed in brackets, if the\nUNIX dialect supports IPv6.  When an IP\nversion is selected, only its numeric\naddresses may be specified.\nservice is an /etc/services name - e.g., smtp -\nor a list of them.\nport is a port number, or a list of them.\n\nIPv6  options may be used only if the UNIX dialect supports IPv6.  To see if the di‐\nalect supports IPv6, run lsof and specify the -h or -?  (help) option.  If the  dis‐\nplayed  description of the -i option contains ``[46]'' and ``IPv[46]'', IPv6 is sup‐\nported.\n\nIPv4 host names and addresses may not be specified if network file selection is lim‐\nited to IPv6 with -i 6.  IPv6 host names and addresses may not be specified if  net‐\nwork  file selection is limited to IPv4 with -i 4.  When an open IPv4 network file's\naddress is mapped in an IPv6 address, the open file's type will be IPv6,  not  IPv4,\nand its display will be selected by '6', not '4'.\n\nAt  least  one  address component - 4, 6, protocol, hostname, hostaddr, or service -\nmust be supplied.  The `@' character, leading the host specification, is always  re‐\nquired;  as  is the `:', leading the port specification.  Specify either hostname or\nhostaddr.  Specify either service name list or port number list.  If a service  name\nlist  is  specified,  the protocol may also need to be specified if the TCP, UDP and\nUDPLITE port numbers for the service name are different.  Use any case  -  lower  or\nupper - for protocol.\n\nService names and port numbers may be combined in a list whose entries are separated\nby  commas  and whose numeric range entries are separated by minus signs.  There may\nbe no embedded spaces, and all service names must belong to the specified  protocol.\nSince  service names may contain embedded minus signs, the starting entry of a range\ncan't be a service name; it can be a port number, however.\n\nHere are some sample addresses:\n\n-i6 - IPv6 only\nTCP:25 - TCP and port 25\n@1.2.3.4 - Internet IPv4 host address 1.2.3.4\n@[3ffe:1ebc::1]:1234 - Internet IPv6 host address\n3ffe:1ebc::1, port 1234\nUDP:who - UDP who service port\nTCP@lsof.itap:513 - TCP, port 513 and host name lsof.itap\ntcp@foo:1-10,smtp,99 - TCP, ports 1 through 10,\nservice name smtp, port 99, host name foo\ntcp@bar:1-smtp - TCP, ports 1 through smtp, host bar\n:time - either TCP, UDP or UDPLITE time service port\n",
                    "flag": "-i"
                },
                {
                    "name": "-K _",
                    "content": "reporting is supported.  (If help output - i.e., the output of the -h or -?  options\n- shows this option, then task (thread) reporting is supported by the dialect.)\n\nIf -K is followed by a value, k, it must be  ``i''.   That  causes  lsof  to  ignore\ntasks,  particularly  in the default, list-everything case when no other options are\nspecified.\n\nWhen -K and -a are both specified on Linux, and the tasks of a main process are  se‐\nlected  by  other  options, the main process will also be listed as though it were a\ntask, but without a task ID.  (See the description of the TID column in  the  OUTPUT\nsection.)\n\nWhere  the  FreeBSD  version supports threads, all threads will be listed with their\nIDs.\n\nIn general threads and tasks inherit the files of the caller, but may close some and\nopen others, so lsof always reports all the open files of threads and tasks.\n",
                    "flag": "-K"
                },
                {
                    "name": "-k _ -k",
                    "content": "available under AIX on the IBM RISC/System 6000.\n",
                    "flag": "-k"
                },
                {
                    "name": "-l",
                    "content": "login name lookup is working improperly or slowly.\n\n+|-L [l] enables (`+') or disables (`-') the listing of file  link  counts,  where  they  are\navailable - e.g., they aren't available for sockets, or most FIFOs and pipes.\n\nWhen  +L  is  specified  without a following number, all link counts will be listed.\nWhen -L is specified (the default), no link counts will be listed.\n\nWhen +L is followed by a number, only files having a link count less than that  num‐\nber will be listed.  (No number may follow -L.)  A specification of the form ``+L1''\nwill  select  open  files  that  have  been  unlinked.   A specification of the form\n``+aL1 <filesystem>'' will select unlinked open files on the specified file system.\n\nFor other link count comparisons, use field output (-F) and a post-processing script\nor program.\n\n+|-m m   specifies an alternate kernel memory file or activates mount table  supplement  pro‐\ncessing.\n\nThe  option  form  -m  m specifies a kernel memory file, m, in place of /dev/kmem or\n/dev/mem - e.g., a crash dump file.\n\nThe option form +m requests that a mount supplement file be written to the  standard\noutput file.  All other options are silently ignored.\n\nThere will be a line in the mount supplement file for each mounted file system, con‐\ntaining  the  mounted file system directory, followed by a single space, followed by\nthe device number in hexadecimal \"0x\" format - e.g.,\n\n/ 0x801\n\nLsof can use the mount supplement file to get device numbers for file  systems  when\nit can't get them via stat(2) or lstat(2).\n\nThe option form +m m identifies m as a mount supplement file.\n\nNote:  the  +m and +m m options are not available for all supported dialects.  Check\nthe output of lsof's -h or -?  options to see if the +m and +m m options are  avail‐\nable.\n\n+|-M     Enables (+) or disables (-) the reporting of portmapper registrations for local TCP,\nUDP  and UDPLITE ports, where port mapping is supported.  (See the last paragraph of\nthis option description for information about where portmapper registration  report‐\ning is supported.)\n\nThe  default  reporting mode is set by the lsof builder with the HASPMAPENABLED #de‐\nfine in the dialect's machine.h header file; lsof is distributed with the HASPMAPEN‐\nABLED #define deactivated, so portmapper reporting is disabled by default  and  must\nbe  requested  with  +M.  Specifying lsof's -h or -?  option will report the default\nmode.  Disabling portmapper registration when it is already disabled or enabling  it\nwhen  already  enabled is acceptable.  When portmapper registration reporting is en‐\nabled, lsof displays the portmapper registration (if any) for local TCP, UDP or  UD‐\nPLITE  ports  in  square  brackets immediately following the port numbers or service\nnames - e.g., ``:1234[name]'' or ``:name[100083]''.   The  registration  information\nmay  be  a name or number, depending on what the registering program supplied to the\nportmapper when it registered the port.\n\nWhen portmapper registration reporting is enabled, lsof may run a little more slowly\nor even become blocked when access to the portmapper becomes congested  or  stopped.\nReverse  the  reporting  mode  to  determine if portmapper registration reporting is\nslowing or blocking lsof.\n\nFor purposes of portmapper registration reporting lsof considers a TCP, UDP  or  UD‐\nPLITE  port  local if: it is found in the local part of its containing kernel struc‐\nture; or if it is located in the foreign part of its containing kernel structure and\nthe local and foreign Internet addresses are the same; or if it is  located  in  the\nforeign  part of its containing kernel structure and the foreign Internet address is\nINADDRLOOPBACK (127.0.0.1).  This rule may make lsof ignore some foreign  ports  on\nmachines  with multiple interfaces when the foreign Internet address is on a differ‐\nent interface from the local one.\n\nSee the lsof FAQ (The FAQ section gives its location.)  for  further  discussion  of\nportmapper registration reporting issues.\n\nPortmapper registration reporting is supported only on dialects that have RPC header\nfiles.   (Some Linux distributions with GlibC 2.14 do not have them.)  When portmap‐\nper registration reporting is supported, the -h or -?  help  output  will  show  the\n+|-M option.\n",
                    "flag": "-l"
                },
                {
                    "name": "-n",
                    "content": "hibiting conversion may make lsof run faster.  It is  also  useful  when  host  name\nlookup is not working properly.\n",
                    "flag": "-n"
                },
                {
                    "name": "-N",
                    "content": "",
                    "flag": "-N"
                },
                {
                    "name": "-o",
                    "content": "column title to be changed to OFFSET.  Note: on some UNIX dialects lsof can't obtain\naccurate or consistent file offset information from its kernel data  sources,  some‐\ntimes just for particular kinds of files (e.g., socket files.)  Consult the lsof FAQ\n(The FAQ section gives its location.)  for more information.\n\nThe  -o  and  -s options are mutually exclusive; they can't both be specified.  When\nneither is specified, lsof displays whatever value - size or offset - is appropriate\nand available for the type of the file.\n",
                    "flag": "-o"
                },
                {
                    "name": "-o _",
                    "content": "offset before the form is switched to ``0x...''.  An o value of zero (unlimited) di‐\nrects lsof to use the ``0t'' form for all offset output.\n\nThis option does NOT direct lsof to display offset at all times; specify -o (without\na  trailing  number)  to  do  that.   -o o only specifies the number of digits after\n``0t'' in either mixed size and offset or offset-only output.  Thus, for example, to\ndirect lsof to display offset at all times with a decimal digit count of 10, use:\n\n-o -o 10\nor\n-oo10\n\nThe default number of digits allowed after ``0t'' is normally 8, but may  have  been\nchanged by the lsof builder.  Consult the description of the -o o option in the out‐\nput of the -h or -?  option to determine the default that is in effect.\n",
                    "flag": "-o"
                },
                {
                    "name": "-O",
                    "content": "operations - i.e., doing them in forked child processes.  See the BLOCKS  AND  TIME‐\nOUTS  and  AVOIDING KERNEL BLOCKS sections for more information on kernel operations\nthat may block lsof.\n\nWhile use of this option will reduce lsof startup overhead, it may also  cause  lsof\nto hang when the kernel doesn't respond to a function.  Use this option cautiously.\n",
                    "flag": "-O"
                },
                {
                    "name": "-p _",
                    "content": "IDentification (PID) numbers are in the comma-separated set s  -  e.g.,  ``123''  or\n``123,^456''.  (There should be no spaces in the set.)\n\nPID numbers that begin with `^' (negation) represent exclusions.\n\nMultiple  process ID numbers are joined in a single ORed set before participating in\nAND option selection.  However, PID exclusions are applied without ORing  or  ANDing\nand take effect before other selection criteria are applied.\n",
                    "flag": "-p"
                },
                {
                    "name": "-P",
                    "content": "the  conversion may make lsof run a little faster.  It is also useful when port name\nlookup is not working properly.\n",
                    "flag": "-P"
                },
                {
                    "name": "-Q",
                    "content": "users  of  a  device, or for a specific PID, or for certain protocols in use by that\nPID, and so on, lsof will return an error if any of the search  results  are  empty.\nThe  -Q option will change this behavior so that lsof will instead return a success‐\nful exit code (0) even if any of the search results are empty. In addition,  missing\nsearch terms will not be reported to stderr.\n\n+|-r [t[c<N>][m<fmt>]]\nputs lsof in repeat mode.  There lsof lists open files as selected by other options,\ndelays  t  seconds (default fifteen), then repeats the listing, delaying and listing\nrepetitively until stopped by a condition defined by the prefix to the option.\n\nIf the prefix is a `-', repeat mode is endless.  Lsof must be terminated with an in‐\nterrupt or quit signal.  `c<N>' is for specifying the limits of  repeating;  if  the\nnumber of iterations reaches at `<N>', Lsof stops itself.\n\nIf  the prefix is `+', repeat mode will end the first cycle no open files are listed\n- and of course when lsof is stopped with an interrupt or quit signal.  When  repeat\nmode  ends  because  no  files are listed, the process exit code will be zero if any\nopen files were ever listed; one, if none were ever listed.\n\nLsof marks the end of each listing: if field output is in progress (the  -F,  option\nhas  been  specified),  the  default  marker is `m'; otherwise the default marker is\n``========''.  The marker is followed by a NL character.\n\nThe optional \"m<fmt>\" argument specifies a format for the marker  line.   The  <fmt>\ncharacters  following  `m'  are  interpreted  as a format specification to the strf‐\ntime(3) function, when both it and the localtime(3) function are  available  in  the\ndialect's  C  library.  Consult the strftime(3) documentation for what may appear in\nits format specification.  Note that when field output is requested with the -F  op‐\ntion,  <fmt>  cannot  contain the NL format, ``%n''.  Note also that when <fmt> con‐\ntains spaces or other characters that affect the  shell's  interpretation  of  argu‐\nments, <fmt> must be quoted appropriately.\n\nRepeat  mode reduces lsof startup overhead, so it is more efficient to use this mode\nthan to call lsof repetitively from a shell script, for example.\n\nTo use repeat mode most efficiently, accompany +|-r with specification of other lsof\nselection options, so the amount of kernel memory access lsof does will be kept to a\nminimum.  Options that filter at the process level - e.g., -c, -g, -p, -u - are  the\nmost efficient selectors.\n\nRepeat  mode  is  useful when coupled with field output (see the -F, option descrip‐\ntion) and a supervising awk or Perl script, or a C program.\n",
                    "flag": "-Q"
                },
                {
                    "name": "-R",
                    "content": "",
                    "flag": "-R"
                },
                {
                    "name": "-s _",
                    "content": "put column title to be changed to SIZE.  If the file does not have a  size,  nothing\nis displayed.\n\nThe  optional -s p:s form is available only for selected dialects, and only when the\n-h or -?  help output lists it.\n\nWhen the optional form is available, the s may be followed by a protocol  name  (p),\neither TCP or UDP, a colon (`:') and a comma-separated protocol state name list, the\noption  causes  open  TCP and UDP files to be excluded if their state name(s) are in\nthe list (s) preceded by a `^'; or included if their name(s) are not preceded  by  a\n`^'.\n\nDialects  that  support  this  option may support only one protocol.  When an unsup‐\nported protocol is specified, a message will be displayed indicating state names for\nthe protocol are unavailable.\n\nWhen an inclusion list is defined, only network files with state names in  the  list\nwill be present in the lsof output.  Thus, specifying one state name means that only\nnetwork files with that lone state name will be listed.\n\nCase  is  unimportant in the protocol or state names, but there may be no spaces and\nthe colon (`:') separating the protocol name (p) and the state name list (s) is  re‐\nquired.\n\nIf  only  TCP  and UDP files are to be listed, as controlled by the specified exclu‐\nsions and inclusions, the -i option must be specified, too.  If only a single proto‐\ncol's files are to be listed, add its name as an argument to the -i option.\n\nFor example, to list only network files with TCP state LISTEN, use:\n\n-iTCP -sTCP:LISTEN\n\nOr, for example, to list network files with all UDP states except Idle, use:\n\n-iUDP -sUDP:^Idle\n\nState names vary with UNIX dialects, so it's not  possible  to  provide  a  complete\nlist.   Some  common  TCP state names are: CLOSED, IDLE, BOUND, LISTEN, ESTABLISHED,\nSYNSENT,  SYNRCDV,  ESTABLISHED,   CLOSEWAIT,   FINWAIT1,   CLOSING,   LASTACK,\nFINWAIT2, and TIMEWAIT.  Two common UDP state names are Unbound and Idle.\n\nSee  the lsof FAQ (The FAQ section gives its location.)  for more information on how\nto use protocol state exclusion and inclusion, including examples.\n\nThe -o (without a following decimal digit count) and -s option (without a  following\nprotocol  and state name list) are mutually exclusive; they can't both be specified.\nWhen neither is specified, lsof displays whatever value - size or offset - is appro‐\npriate and available for the type of file.\n\nSince some types of files don't have true sizes - sockets, FIFOs, pipes, etc. - lsof\ndisplays for their sizes the content amounts in their associated kernel buffers,  if\npossible.\n",
                    "flag": "-s"
                },
                {
                    "name": "-S _",
                    "content": "link(2), and stat(2) - that might otherwise deadlock.  The minimum for t is two; the\ndefault, fifteen; when no value is specified, the default is used.\n\nSee the BLOCKS AND TIMEOUTS section for more information.\n",
                    "flag": "-S"
                },
                {
                    "name": "-T _",
                    "content": "following the network addresses.  In normal output the information appears in paren‐\ntheses,  each item except TCP or TPI state name identified by a keyword, followed by\n`=', separated from others by a single space:\n\n<TCP or TPI state name>\nQR=<read queue length>\nQS=<send queue length>\nSO=<socket options and values>\nSS=<socket states>\nTF=<TCP flags and values>\nWR=<window read length>\nWW=<window write length>\n\nNot all values are reported for all UNIX dialects.  Items  values  (when  available)\nare reported after the item name and '='.\n\nWhen  the field output mode is in effect (See OUTPUT FOR OTHER PROGRAMS.)  each item\nappears as a field with a `T' leading character.\n\n-T with no following key characters disables TCP/TPI information reporting.\n\n-T with following characters selects the reporting of specific TCP/TPI information:\n\nf    selects reporting of socket options,\nstates and values, and TCP flags and\nvalues.\nq    selects queue length reporting.\ns    selects connection state reporting.\nw    selects window size reporting.\n\nNot all selections are enabled for some UNIX dialects.  State may  be  selected  for\nall  dialects  and is reported by default.  The -h or -?  help output for the -T op‐\ntion will show what selections may be used with the UNIX dialect.\n\nWhen -T is used to select information - i.e., it is followed by one or  more  selec‐\ntion characters - the displaying of state is disabled by default, and it must be ex‐\nplicitly  selected  again in the characters following -T.  (In effect, then, the de‐\nfault is equivalent to -Ts.)  For example, if queue lengths and state  are  desired,\nuse -Tqs.\n\nSocket  options,  socket states, some socket values, TCP flags and one TCP value may\nbe reported (when available in the UNIX dialect) in the form of the names that  com‐\nmonly appear after SO, so, SS, TCP  and TF in the dialect's header files - most\noften  <sys/socket.h>,  <sys/socketvar.h>  and  <netinet/tcpvar.h>.   Consult those\nheader files for the meaning of the flags, options, states and values.\n\n``SO='' precedes socket options and values; ``SS='', socket states; and ``TF='', TCP\nflags and values.\n\nIf a flag or option has a value, the value will follow an '=' and the name --  e.g.,\n``SO=LINGER=5'',  ``SO=QLIM=5'',  ``TF=MSS=512''.  The following seven values may be\nreported:\n\nName\nReported  Description (Common Symbol)\n\nKEEPALIVE keep alive time (SOKEEPALIVE)\nLINGER    linger time (SOLINGER)\nMSS       maximum segment size (TCPMAXSEG)\nPQLEN          partial listen queue connections\nQLEN      established listen queue connections\nQLIM      established listen queue limit\nRCVBUF    receive buffer length (SORCVBUF)\nSNDBUF    send buffer length (SOSNDBUF)\n\nDetails on what socket options and values, socket states, and TCP flags  and  values\nmay  be  displayed  for  particular  UNIX dialects may be found in the answer to the\n``Why doesn't lsof report socket options, socket states, and TCP  flags  and  values\nfor  my dialect?'' and ``Why doesn't lsof report the partial listen queue connection\ncount for my dialect?''  questions in the lsof FAQ (The FAQ section gives its  loca‐\ntion.)  On Linux this option also prints the state of UNIX domain sockets.\n",
                    "flag": "-T"
                },
                {
                    "name": "-t",
                    "content": "it is easy to use programmatically. e.g.\n\n# reload anything using old SSL\nlsof -t /lib/*/libssl.so.* | xargs -r kill -HUP\n\n# get list of processes and then iterate over them (Bash only)\nmapfile -t pids < <(\nlsof -wt /var/log/your.log\n)\nfor pid in \"${pids[@]}\" ; do\nyourcommand -p \"$pid\"\ndone\n\nThe -t option implies the -w option.\n",
                    "flag": "-t"
                },
                {
                    "name": "-u _",
                    "content": "in the comma-separated set s - e.g., ``abe'', or ``548,root''.  (There should be  no\nspaces in the set.)\n\nMultiple  login names or user ID numbers are joined in a single ORed set before par‐\nticipating in AND option selection.\n\nIf a login name or user ID is preceded by a `^', it becomes a negation - i.e., files\nof processes owned by the login name or user ID will never be listed.  A negated lo‐\ngin name or user ID selection is neither ANDed nor ORed with other selections; it is\napplied before all other selections and absolutely excludes the listing of the files\nof the process.  For example, to direct lsof to exclude the listing of files belong‐\ning to root processes, specify ``-u^root'' or ``-u^0''.\n",
                    "flag": "-u"
                },
                {
                    "name": "-U",
                    "content": "",
                    "flag": "-U"
                },
                {
                    "name": "-v",
                    "content": "the  lsof  binary was constructed; who constructed the binary and where; the name of\nthe compiler used to construct the lsof binary; the version number of  the  compiler\nwhen readily available; the compiler and loader flags used to construct the lsof bi‐\nnary; and system information, typically the output of uname's -a option.\n",
                    "flag": "-v"
                },
                {
                    "name": "-V",
                    "content": "names, file names, Internet addresses or files, login names, NFS files, PIDs, PGIDs,\nand UIDs.\n\nWhen other options are ANDed to search options, or compile-time options restrict the\nlisting of some files, lsof may not report that it failed to find a search item when\nan  ANDed  option  or compile-time option prevents the listing of the open file con‐\ntaining the located search item.\n\nFor example, ``lsof -V -iTCP@foobar -a -d 999'' may not report a failure  to  locate\nopen  files  at  ``TCP@foobar'' and may not list any, if none have a file descriptor\nnumber of 999.  A similar situation arises when  HASSECURITY  and  HASNOSOCKSECURITY\nare defined at compile time and they prevent the listing of open files.\n\n+|-w     Enables (+) or disables (-) the suppression of warning messages.\n\nThe lsof builder may choose to have warning messages disabled or enabled by default.\nThe  default  warning  message state is indicated in the output of the -h or -?  op‐\ntion.  Disabling warning messages when they are already disabled  or  enabling  them\nwhen already enabled is acceptable.\n\nThe -t option implies the -w option.\n",
                    "flag": "-V"
                },
                {
                    "name": "-x _",
                    "content": "bolic links and|or file system mount points encountered when scanning the  directory\n(+d) or directory tree (+D).\n\nIf -x is specified by itself without a following parameter, cross-over processing of\nboth  symbolic  links and file system mount points is enabled.  Note that when -x is\nspecified without a parameter, the next argument must begin with '-' or '+'.\n\nThe optional 'f' parameter enables file system mount  point  cross-over  processing;\n'l', symbolic link cross-over processing.\n\nThe -x option may not be supplied without also supplying a +d or +D option.\n",
                    "flag": "-x"
                },
                {
                    "name": "-X",
                    "content": "AIX:\nThis  IBM  AIX  RISC/System 6000 option requests the reporting of executed text file\nand shared library references.\n\nWARNING: because this option uses the kernel readx() function, its use on a busy AIX\nsystem might cause an application process to hang so completely that it can  neither\nbe killed nor stopped.  I have never seen this happen or had a report of its happen‐\ning, but I think there is a remote possibility it could happen.\n\nBy  default  use  of  readx()  is  disabled.   On AIX 5L and above lsof may need se‐\ntuid-root permission to perform the actions this option requests.\n\nThe lsof builder may specify that the -X option be  restricted  to  processes  whose\nreal UID is root.  If that has been done, the -X option will not appear in the -h or\n-?   help  output unless the real UID of the lsof process is root.  The default lsof\ndistribution allows any UID to specify -X, so by default it will appear in the  help\noutput.\n\nWhen AIX readx() use is disabled, lsof may not be able to report information for all\ntext  and  loader  file references, but it may also avoid exacerbating an AIX kernel\ndirectory search kernel error, known as the Stale Segment ID bug.\n\nThe readx() function, used by lsof or any other program to access some  sections  of\nkernel  virtual memory, can trigger the Stale Segment ID bug.  It can cause the ker‐\nnel's dirsearch() function to believe erroneously that part of an in-memory copy of\na file system directory has been zeroed.  Another application process, distinct from\nlsof, asking the kernel to search the directory - e.g., by using open(2) - can cause\ndirsearch() to loop forever, thus hanging the application process.\n\nConsult the lsof FAQ (The FAQ section gives its location.)  and the 00README file of\nthe lsof distribution for a more complete description of the Stale Segment  ID  bug,\nits APAR, and methods for defining readx() use when compiling lsof.\n\nLinux:\nThis  Linux  option requests that lsof skip the reporting of information on all open\nTCP, UDP and UDPLITE IPv4 and IPv6 files.\n\nThis Linux option is most useful when the system has an extremely  large  number  of\nopen  TCP,  UDP  and  UDPLITE  files,  the  processing  of  whose information in the\n/proc/net/tcp* and /proc/net/udp* files would take lsof a long time, and  whose  re‐\nporting is not of interest.\n\nUse  this  option with care and only when you are sure that the information you want\nlsof to display isn't associated with open TCP, UDP or UDPLITE socket files.\n\nSolaris 10 and above:\nThis Solaris 10 and above option requests the reporting of cached  paths  for  files\nthat have been deleted - i.e., removed with rm(1) or unlink(2).\n\nThe  cached  path is followed by the string `` (deleted)'' to indicate that the path\nby which the file was opened has been deleted.\n\nBecause intervening changes made to the path - i.e., renames with mv(1) or rename(2)\n- are not recorded in the cached path, what lsof reports is only the path  by  which\nthe file was opened, not its possibly different final path.\n",
                    "flag": "-X"
                },
                {
                    "name": "-z _",
                    "content": "Without a following argument - e.g., NO z - the option specifies that zone names are\nto be listed in the ZONE output column.\n\nThe -z option may be followed by a zone name, z.  That causes lsof to list only open\nfiles  for  processes  in that zone.  Multiple -z z option and argument pairs may be\nspecified to form a list of named zones.  Any open file of any process in any of the\nzones will be listed, subject to other conditions specified by other options and ar‐\nguments.\n",
                    "flag": "-z"
                },
                {
                    "name": "-Z _",
                    "content": "character  support  are inhibited when SELinux is disabled in the running Linux ker‐\nnel.  See OUTPUT FOR OTHER PROGRAMS for more information on  the  'Z'  field  output\ncharacter.\n\nWithout  a following argument - e.g., NO Z - the option specifies that security con‐\ntexts are to be listed in the SECURITY-CONTEXT output column.\n\nThe -Z option may be followed by a wildcard security context name, Z.   That  causes\nlsof  to list only open files for processes in that security context.  Multiple -Z Z\noption and argument pairs may be specified to form a list of security contexts.  Any\nopen file of any process in any of the security contexts will be listed, subject  to\nother conditions specified by other options and arguments.  Note that Z can be A:B:C\nor *:B:C or A:B:* or *:*:C to match against the A:B:C context.\n\n--       The  double minus sign option is a marker that signals the end of the keyed options.\nIt may be used, for example, when the first file name begins with a minus sign.   It\nmay  also be used when the absence of a value for the last keyed option must be sig‐\nnified by the presence of a minus sign in the following option and before the  start\nof the file names.\n\nnames    These  are path names of specific files to list.  Symbolic links are resolved before\nuse.  The first name may be separated from the preceding options with the ``--'' op‐\ntion.\n\nIf a name is the mounted-on directory of a file system or the  device  of  the  file\nsystem,  lsof  will  list all the files open on the file system.  To be considered a\nfile system, the name must match a mounted-on directory name in mount(8) output,  or\nmatch  the  name of a block device associated with a mounted-on directory name.  The\n+|-f option may be used to force lsof to consider a name a  file  system  identifier\n(+f) or a simple file (-f).\n\nIf name is a path to a directory that is not the mounted-on directory name of a file\nsystem,  it  is treated just as a regular file is treated - i.e., its listing is re‐\nstricted to processes that have it open as a file or as  a  process-specific  direc‐\ntory,  such as the root or current working directory.  To request that lsof look for\nopen files inside a directory name, use the +d s and +D D options.\n\nIf a name is the base name of a family of multiplexed files - e.g, AIX's /dev/pt[cs]\n- lsof will list all the associated multiplexed files on the device that are open  -\ne.g., /dev/pt[cs]/1, /dev/pt[cs]/2, etc.\n\nIf a name is a UNIX domain socket name, lsof will usually search for it by the char‐\nacters  of the name alone - exactly as it is specified and is recorded in the kernel\nsocket structure.  (See the next paragraph for an exception to that rule for Linux.)\nSpecifying a relative path - e.g., ./file - in place of the file's absolute  path  -\ne.g., /tmp/file - won't work because lsof must match the characters you specify with\nwhat it finds in the kernel UNIX domain socket structures.\n\nIf a name is a Linux UNIX domain socket name, in one case lsof is able to search for\nit  by  its  device and inode number, allowing name to be a relative path.  The case\nrequires that the absolute path -- i.e., one beginning with a slash ('/') be used by\nthe process that created the socket, and hence be stored in the /proc/net/unix file;\nand it requires that lsof be able to obtain the device and node numbers of both  the\nabsolute  path in /proc/net/unix and name via successful stat(2) system calls.  When\nthose conditions are met, lsof will be able to search for  the  UNIX  domain  socket\nwhen  some  path  to  it is is specified in name.  Thus, for example, if the path is\n/dev/log, and an lsof search is initiated when the working directory is  /dev,  then\nname could be ./log.\n\nIf a name is none of the above, lsof will list any open files whose device and inode\nmatch that of the specified path name.\n\nIf  you have also specified the -b option, the only names you may safely specify are\nfile systems for which your mount table supplies alternate device numbers.  See  the\nAVOIDING KERNEL BLOCKS and ALTERNATE DEVICE NUMBERS sections for more information.\n\nMultiple  file names are joined in a single ORed set before participating in AND op‐\ntion selection.\n",
                    "flag": "-Z"
                }
            ]
        },
        "AFS": {
            "content": "Lsof supports the recognition of AFS files for these dialects (and AFS versions):\n\nAIX 4.1.4 (AFS 3.4a)\nHP-UX 9.0.5 (AFS 3.4a)\nLinux 1.2.13 (AFS 3.3)\nSolaris 2.[56] (AFS 3.4a)\n\nIt may recognize AFS files on other versions of these  dialects,  but  has  not  been  tested\nthere.   Depending on how AFS is implemented, lsof may recognize AFS files in other dialects,\nor may have difficulties recognizing AFS files in the supported dialects.\n\nLsof may have trouble identifying all aspects of AFS files in  supported  dialects  when  AFS\nkernel  support  is implemented via dynamic modules whose addresses do not appear in the ker‐\nnel's variable name list.  In that case, lsof may have to guess at the identity of AFS files,\nand might not be able to obtain volume information from the kernel that is needed for  calcu‐\nlating  AFS  volume  node  numbers.   When lsof can't compute volume node numbers, it reports\nblank in the NODE column.\n\nThe -A A option is available in some dialect implementations of lsof for specifying the  name\nlist file where dynamic module kernel addresses may be found.  When this option is available,\nit will be listed in the lsof help output, presented in response to the -h or -?\n\nSee  the  lsof  FAQ (The FAQ section gives its location.)  for more information about dynamic\nmodules, their symbols, and how they affect lsof options.\n\nBecause AFS path lookups don't seem to participate in the  kernel's  name  cache  operations,\nlsof can't identify path name components for AFS files.\n",
            "subsections": []
        },
        "SECURITY": {
            "content": "Lsof  has  three  features  that may cause security concerns.  First, its default compilation\nmode allows anyone to list all  open  files  with  it.   Second,  by  default  it  creates  a\nuser-readable  and  user-writable device cache file in the home directory of the real user ID\nthat executes lsof.  (The list-all-open-files and device cache features may be disabled  when\nlsof  is  compiled.)   Third, its -k and -m options name alternate kernel name list or memory\nfiles.\n\nRestricting the listing of all open files is controlled by the compile-time  HASSECURITY  and\nHASNOSOCKSECURITY  options.   When HASSECURITY is defined, lsof will allow only the root user\nto list all open files.  The non-root user may list only open files  of  processes  with  the\nsame  user IDentification number as the real user ID number of the lsof process (the one that\nits user logged on with).\n\nHowever, if HASSECURITY and HASNOSOCKSECURITY are both defined, anyone may list  open  socket\nfiles, provided they are selected with the -i option.\n\nWhen HASSECURITY is not defined, anyone may list all open files.\n\nHelp  output, presented in response to the -h or -?  option, gives the status of the HASSECU‐\nRITY and HASNOSOCKSECURITY definitions.\n\nSee the Security section of the 00README file of the lsof  distribution  for  information  on\nbuilding lsof with the HASSECURITY and HASNOSOCKSECURITY options enabled.\n\nCreation  and use of a user-readable and user-writable device cache file is controlled by the\ncompile-time HASDCACHE option.  See the DEVICE CACHE FILE section and the sections that  fol‐\nlow it for details on how its path is formed.  For security considerations it is important to\nnote  that in the default lsof distribution, if the real user ID under which lsof is executed\nis root, the device cache file will be written in root's home directory - e.g., /  or  /root.\nWhen HASDCACHE is not defined, lsof does not write or attempt to read a device cache file.\n\nWhen  HASDCACHE is defined, the lsof help output, presented in response to the -h, -D?, or -?\noptions, will provide device cache file handling information.  When HASDCACHE is not defined,\nthe -h or -?  output will have no -D option description.\n\nBefore you decide to disable the device cache file feature - enabling it improves the perfor‐\nmance of lsof by reducing the startup overhead of examining all the nodes in  /dev  (or  /de‐\nvices) - read the discussion of it in the 00DCACHE file of the lsof distribution and the lsof\nFAQ (The FAQ section gives its location.)\n\nWHEN  IN DOUBT, YOU CAN TEMPORARILY DISABLE THE USE OF THE DEVICE CACHE FILE WITH THE -Di OP‐\nTION.\n\nWhen lsof user declares alternate kernel name list or memory files with the  -k  and  -m  op‐\ntions,  lsof  checks  the  user's authority to read them with access(2).  This is intended to\nprevent whatever special power lsof's modes might confer on it from letting it read files not\nnormally accessible via the authority of the real user ID.\n",
            "subsections": []
        },
        "OUTPUT": {
            "content": "This section describes the information lsof lists for each open file.   See  the  OUTPUT  FOR\nOTHER  PROGRAMS section for additional information on output that can be processed by another\nprogram.\n\nLsof only outputs printable (declared so by  isprint(3))  8  bit  characters.   Non-printable\ncharacters  are printed in one of three forms: the C ``\\[bfrnt]'' form; the control character\n`^' form (e.g., ``^@''); or hexadecimal leading  ``\\x''  form  (e.g.,  ``\\xab'').   Space  is\nnon-printable in the COMMAND column (``\\x20'') and printable elsewhere.\n\nFor  some dialects - if HASSETLOCALE is defined in the dialect's machine.h header file - lsof\nwill print the extended 8 bit characters of a language locale.  The lsof process must be sup‐\nplied a language locale environment variable (e.g., LANG) whose value represents a known lan‐\nguage locale in which the extended characters are considered printable by isprint(3).  Other‐\nwise lsof considers the extended characters non-printable and prints them  according  to  its\nrules  for  non-printable  characters, stated above.  Consult your dialect's setlocale(3) man\npage for the names of other environment variables that may be used in place of LANG  -  e.g.,\nLCALL, LCCTYPE, etc.\n\nLsof's language locale support for a dialect also covers wide characters - e.g., UTF-8 - when\nHASSETLOCALE  and  HASWIDECHAR are defined in the dialect's machine.h header file, and when a\nsuitable language locale has been defined in the appropriate  environment  variable  for  the\nlsof  process.   Wide  characters are printable under those conditions if iswprint(3) reports\nthem to be.  If HASSETLOCALE, HASWIDECHAR and a suitable language locale aren't  defined,  or\nif iswprint(3) reports wide characters that aren't printable, lsof considers the wide charac‐\nters  non-printable  and prints each of their 8 bits according to its rules for non-printable\ncharacters, stated above.\n\nConsult the answers to the \"Language locale support\" questions in the lsof FAQ (The FAQ  sec‐\ntion gives its location.) for more information.\n\nLsof dynamically sizes the output columns each time it runs, guaranteeing that each column is\na  minimum size.  It also guarantees that each column is separated from its predecessor by at\nleast one space.\n\nCOMMAND    contains the first nine characters of the name of the UNIX command associated with\nthe process.  If a non-zero w value is specified to the +c w  option,  the  column\ncontains  the  first  w characters of the name of the UNIX command associated with\nthe process up to the limit of characters supplied to lsof by  the  UNIX  dialect.\n(See  the  description  of  the +c w command or the lsof FAQ for more information.\nThe FAQ section gives its location.)\n\nIf w is less than the length of the column title, ``COMMAND'', it will  be  raised\nto that length.\n\nIf  a  zero  w  value is specified to the +c w option, the column contains all the\ncharacters of the name of the UNIX command associated with the process.\n\nAll command name characters maintained by the kernel in its  structures  are  dis‐\nplayed  in  field output when the command name descriptor (`c') is specified.  See\nthe OUTPUT FOR OTHER COMMANDS section for information on  selecting  field  output\nand the associated command name descriptor.\n\nPID        is the Process IDentification number of the process.\n\nTID        is  the  task  (thread)  IDentification number, if task (thread) reporting is sup‐\nported by the dialect and a task (thread) is being  listed.   (If  help  output  -\ni.e.,  the output of the -h or -?  options - shows this option, then task (thread)\nreporting is supported by the dialect.)\n\nA blank TID column in Linux indicates a process - i.e., a non-task.\n\nTASKCMD    is the task command name.  Generally this will be the same as the process named in\nthe COMMAND column, but some task implementations (e.g., Linux) permit a  task  to\nchange its command name.\n\nThe  TASKCMD  column  width  is subject to the same size limitation as the COMMAND\ncolumn.\n\nZONE       is the Solaris 10 and higher zone name.  This column must be selected with the  -z\noption.\n\nSECURITY-CONTEXT\nis the SELinux security context.  This column must be selected with the -Z option.\nNote that the -Z option is inhibited when SELinux is disabled in the running Linux\nkernel.\n\nPPID       is  the Parent Process IDentification number of the process.  It is only displayed\nwhen the -R option has been specified.\n\nPGID       is the process group IDentification number associated with  the  process.   It  is\nonly displayed when the -g option has been specified.\n\nUSER       is  the user ID number or login name of the user to whom the process belongs, usu‐\nally the same as reported by ps(1).  However, on Linux USER is the user ID  number\nor  login  that owns the directory in /proc where lsof finds information about the\nprocess.  Usually that is the same value reported by ps(1), but  may  differ  when\nthe process has changed its effective user ID.  (See the -l option description for\ninformation on when a user ID number or login name is displayed.)\n\nFD         is the File Descriptor number of the file or:\n\ncwd  current working directory;\nLnn  library references (AIX);\nerr  FD information error (see NAME column);\njld  jail directory (FreeBSD);\nltx  shared library text (code and data);\nMxx  hex memory-mapped type number xx.\nm86  DOS Merge mapped file;\nmem  memory-mapped file;\nmmap memory-mapped device;\npd   parent directory;\nrtd  root directory;\ntr   kernel trace file (OpenBSD);\ntxt  program text (code and data);\nv86  VP/ix mapped file;\n\nFD  is  followed  by  one of these characters, describing the mode under which the\nfile is open:\n\nr for read access;\nw for write access;\nu for read and write access;\nspace if mode unknown and no lock\ncharacter follows;\n`-' if mode unknown and lock\ncharacter follows.\n\nThe mode character is followed by one of these  lock  characters,  describing  the\ntype of lock applied to the file:\n\nN for a Solaris NFS lock of unknown type;\nr for read lock on part of the file;\nR for a read lock on the entire file;\nw for a write lock on part of the file;\nW for a write lock on the entire file;\nu for a read and write lock of any length;\nU for a lock of unknown type;\nx for an SCO OpenServer Xenix lock on part      of the file;\nX for an SCO OpenServer Xenix lock on the entire file;\nspace if there is no lock.\n\nSee the LOCKS section for more information on the lock information character.\n\nThe  FD  column contents constitutes a single field for parsing in post-processing\nscripts.\n\nTYPE       is the type of the node associated with the file - e.g., GDIR, GREG,  VDIR,  VREG,\netc.\n\nor ``IPv4'' for an IPv4 socket;\n\nor ``IPv6'' for an open IPv6 network file - even if its address is IPv4, mapped in\nan IPv6 address;\n\nor ``ax25'' for a Linux AX.25 socket;\n\nor ``inet'' for an Internet domain socket;\n\nor ``lla'' for a HP-UX link level access file;\n\nor ``rte'' for an AFROUTE socket;\n\nor ``sock'' for a socket of unknown domain;\n\nor ``unix'' for a UNIX domain socket;\n\nor ``x.25'' for an HP-UX x.25 socket;\n\nor ``BLK'' for a block special file;\n\nor ``CHR'' for a character special file;\n\nor ``DEL'' for a Linux map file that has been deleted;\n\nor ``DIR'' for a directory;\n\nor ``DOOR'' for a VDOOR file;\n\nor ``FIFO'' for a FIFO special file;\n\nor ``KQUEUE'' for a BSD style kernel event queue file;\n\nor ``LINK'' for a symbolic link file;\n\nor ``MPB'' for a multiplexed block file;\n\nor ``MPC'' for a multiplexed character file;\n\nor  ``NOFD''  for a Linux /proc/<PID>/fd directory that can't be opened -- the di‐\nrectory path appears in the NAME column, followed by an error message;\n\nor ``PAS'' for a /proc/as file;\n\nor ``PAXV'' for a /proc/auxv file;\n\nor ``PCRE'' for a /proc/cred file;\n\nor ``PCTL'' for a /proc control file;\n\nor ``PCUR'' for the current /proc process;\n\nor ``PCWD'' for a /proc current working directory;\n\nor ``PDIR'' for a /proc directory;\n\nor ``PETY'' for a /proc executable type (etype);\n\nor ``PFD'' for a /proc file descriptor;\n\nor ``PFDR'' for a /proc file descriptor directory;\n\nor ``PFIL'' for an executable /proc file;\n\nor ``PFPR'' for a /proc FP register set;\n\nor ``PGD'' for a /proc/pagedata file;\n\nor ``PGID'' for a /proc group notifier file;\n\nor ``PIPE'' for pipes;\n\nor ``PLC'' for a /proc/lwpctl file;\n\nor ``PLDR'' for a /proc/lpw directory;\n\nor ``PLDT'' for a /proc/ldt file;\n\nor ``PLPI'' for a /proc/lpsinfo file;\n\nor ``PLST'' for a /proc/lstatus file;\n\nor ``PLU'' for a /proc/lusage file;\n\nor ``PLWG'' for a /proc/gwindows file;\n\nor ``PLWI'' for a /proc/lwpsinfo file;\n\nor ``PLWS'' for a /proc/lwpstatus file;\n\nor ``PLWU'' for a /proc/lwpusage file;\n\nor ``PLWX'' for a /proc/xregs file;\n\nor ``PMAP'' for a /proc map file (map);\n\nor ``PMEM'' for a /proc memory image file;\n\nor ``PNTF'' for a /proc process notifier file;\n\nor ``POBJ'' for a /proc/object file;\n\nor ``PODR'' for a /proc/object directory;\n\nor ``POLP'' for an old format /proc light weight process file;\n\nor ``POPF'' for an old format /proc PID file;\n\nor ``POPG'' for an old format /proc page data file;\n\nor ``PORT'' for a SYSV named pipe;\n\nor ``PREG'' for a /proc register file;\n\nor ``PRMP'' for a /proc/rmap file;\n\nor ``PRTD'' for a /proc root directory;\n\nor ``PSGA'' for a /proc/sigact file;\n\nor ``PSIN'' for a /proc/psinfo file;\n\nor ``PSTA'' for a /proc status file;\n\nor ``PSXMQ'' for a POSIX message queue file;\n\nor ``PSXSEM'' for a POSIX semaphore file;\n\nor ``PSXSHM'' for a POSIX shared memory file;\n\nor ``PTS'' for a /dev/pts file;\n\nor ``PUSG'' for a /proc/usage file;\n\nor ``PW'' for a /proc/watch file;\n\nor ``PXMP'' for a /proc/xmap file;\n\nor ``REG'' for a regular file;\n\nor ``SMT'' for a shared memory transport file;\n\nor ``STSO'' for a stream socket;\n\nor ``UNNM'' for an unnamed type file;\n\nor ``XNAM'' for an OpenServer Xenix special file of unknown type;\n\nor ``XSEM'' for an OpenServer Xenix semaphore file;\n\nor ``XSD'' for an OpenServer Xenix shared data file;\n\nor the four type number octets if the corresponding name isn't known.\n\nFILE-ADDR  contains the kernel file structure address when f has been specified to +f;\n\nFCT        contains the file reference count from the kernel file structure when c  has  been\nspecified to +f;\n\nFILE-FLAG  when  g  or  G  has  been specified to +f, this field contains the contents of the\nfflag[s] member of the kernel file structure and the  kernel's  per-process  open\nfile flags (if available); `G' causes them to be displayed in hexadecimal; `g', as\nshort-hand names; two lists may be displayed with entries separated by commas, the\nlists  separated by a semicolon (`;'); the first list may contain short-hand names\nfor fflag[s] values from the following table:\n\nAIO       asynchronous I/O (e.g., FAIO)\nAP        append\nASYN      asynchronous I/O (e.g., FASYNC)\nBAS       block, test, and set in use\nBKIU      block if in use\nBL        use block offsets\nBSK       block seek\nCA        copy avoid\nCIO       concurrent I/O\nCLON      clone\nCLRD      CL read\nCR        create\nDF        defer\nDFI       defer IND\nDFLU      data flush\nDIR       direct\nDLY       delay\nDOCL      do clone\nDSYN      data-only integrity\nDTY       must be a directory\nEVO       event only\nEX        open for exec\nEXCL      exclusive open\nFSYN      synchronous writes\nGCDF      defer during unpgc() (AIX)\nGCMK      mark during unpgc() (AIX)\nGTTY      accessed via /dev/tty\nHUP       HUP in progress\nKERN      kernel\nKIOC      kernel-issued ioctl\nLCK       has lock\nLG        large file\nMBLK      stream message block\nMK        mark\nMNT       mount\nMSYN      multiplex synchronization\nNATM      don't update atime\nNB        non-blocking I/O\nNBDR      no BDRM check\nNBIO      SYSV non-blocking I/O\nNBF       n-buffering in effect\nNC        no cache\nND        no delay\nNDSY      no data synchronization\nNET       network\nNFLK      don't follow links\nNMFS      NM file system\nNOTO      disable background stop\nNSH       no share\nNTTY      no controlling TTY\nOLRM      OLR mirror\nPAIO      POSIX asynchronous I/O\nPATH      path\nPP        POSIX pipe\nR         read\nRC        file and record locking cache\nREV       revoked\nRSH       shared read\nRSYN      read synchronization\nRW        read and write access\nSL        shared lock\nSNAP      cooked snapshot\nSOCK      socket\nSQSH      Sequent shared set on open\nSQSV      Sequent SVM set on open\nSQR       Sequent set repair on open\nSQS1      Sequent full shared open\nSQS2      Sequent partial shared open\nSTPI      stop I/O\nSWR       synchronous read\nSYN       file integrity while writing\nTCPM      avoid TCP collision\nTMPF      temporary file\nTR        truncate\nW         write\nWKUP      parallel I/O synchronization\nWTG       parallel I/O synchronization\nVH        vhangup pending\nVTXT      virtual text\nXL        exclusive lock\n\nthis list of names was derived from F* #define's  in  dialect  header  files  <fc‐\nntl.h>,  <linux</fs.h>, <sys/fcntl.c>, <sys/fcntlcom.h>, and <sys/file.h>; see the\nlsof.h header file for a list showing the correspondence between the above  short-\nhand names and the header file definitions;\n\nthe second list (after the semicolon) may contain short-hand names for kernel per-\nprocess open file flags from this table:\n\nALLC      allocated\nBR        the file has been read\nBHUP      activity stopped by SIGHUP\nBW        the file has been written\nCLSG      closing\nCX        close-on-exec (see fcntl(FSETFD))\nLCK       lock was applied\nMP        memory-mapped\nOPIP      open pending - in progress\nRSVW      reserved wait\nSHMT      UFFSHMAT set (AIX)\nUSE       in use (multi-threaded)\n\nNODE-ID    (or  INODE-ADDR  for some dialects) contains a unique identifier for the file node\n(usually the kernel vnode or inode address, but also occasionally a  concatenation\nof device and node number) when n has been specified to +f;\n\nDEVICE     contains  the  device numbers, separated by commas, for a character special, block\nspecial, regular, directory or NFS file;\n\nor ``memory'' for a memory file system node under Tru64 UNIX;\n\nor the address of the private data area of a Solaris socket stream;\n\nor a kernel reference address that identifies the file (The kernel  reference  ad‐\ndress may be used for FIFO's, for example.);\n\nor the base address or device name of a Linux AX.25 socket device.\n\nUsually  only  the  lower  thirty two bits of Tru64 UNIX kernel addresses are dis‐\nplayed.\n\nSIZE, SIZE/OFF, or OFFSET\nis the size of the file or the file offset in bytes.  A value is displayed in this\ncolumn only if it is available.  Lsof displays whatever value - size or  offset  -\nis appropriate for the type of the file and the version of lsof.\n\nOn  some UNIX dialects lsof can't obtain accurate or consistent file offset infor‐\nmation from its kernel data sources, sometimes just for particular kinds of  files\n(e.g.,  socket  files.)  In other cases, files don't have true sizes - e.g., sock‐\nets, FIFOs, pipes - so lsof displays for their sizes the content amounts it  finds\nin their kernel buffer descriptors (e.g., socket buffer size counts or TCP/IP win‐\ndow  sizes.)  Consult the lsof FAQ (The FAQ section gives its location.)  for more\ninformation.\n\nThe file size is displayed in decimal; the offset is normally displayed in decimal\nwith a leading ``0t'' if it contains 8 digits or less; in hexadecimal with a lead‐\ning ``0x'' if it is longer than 8 digits.  (Consult the -o  o  option  description\nfor information on when 8 might default to some other value.)\n\nThus  the leading ``0t'' and ``0x'' identify an offset when the column may contain\nboth a size and an offset (i.e., its title is SIZE/OFF).\n\nIf the -o option is specified, lsof always displays the file offset (or nothing if\nno offset is available) and labels the column OFFSET.  The  offset  always  begins\nwith ``0t'' or ``0x'' as described above.\n\nThe  lsof  user can control the switch from ``0t'' to ``0x'' with the -o o option.\nConsult its description for more information.\n\nIf the -s option is specified, lsof always displays the file size (or  nothing  if\nno size is available) and labels the column SIZE.  The -o and -s options are mutu‐\nally exclusive; they can't both be specified.\n\nFor  files  that  don't  have a fixed size - e.g., don't reside on a disk device -\nlsof will display appropriate information about the current size  or  position  of\nthe file if it is available in the kernel structures that define the file.\n\nNLINK      contains the file link count when +L has been specified;\n\nNODE       is the node number of a local file;\n\nor the inode number of an NFS file in the server host;\n\nor the Internet protocol type - e.g, ``TCP'';\n\nor ``STR'' for a stream;\n\nor ``CCITT'' for an HP-UX x.25 socket;\n\nor the IRQ or inode number of a Linux AX.25 socket device.\n\nNAME       is the name of the mount point and file system on which the file resides;\n\nor the name of a file specified in the names option (after any symbolic links have\nbeen resolved);\n\nor the name of a character special or block special device;\n\nor  the local and remote Internet addresses of a network file; the local host name\nor IP number is followed by a colon (':'), the port, ``->'', and the two-part  re‐\nmote  address;  IP addresses may be reported as numbers or names, depending on the\n+|-M, -n, and -P options; colon-separated IPv6  numbers  are  enclosed  in  square\nbrackets;  IPv4  INADDRANY  and  IPv6 IN6ISADDRUNSPECIFIED addresses, and zero\nport numbers are represented by an asterisk ('*'); a UDP destination  address  may\nbe  followed  by  the amount of time elapsed since the last packet was sent to the\ndestination; TCP, UDP and UDPLITE remote addresses may be followed by TCP/TPI  in‐\nformation  in  parentheses - state (e.g., ``(ESTABLISHED)'', ``(Unbound)''), queue\nsizes, and window sizes (not all dialects) - in a fashion  similar  to  what  net‐\nstat(1)  reports;  see the -T option description or the description of the TCP/TPI\nfield in OUTPUT FOR OTHER PROGRAMS for more information on state, queue size,  and\nwindow size;\n\nor  the address or name of a UNIX domain socket, possibly including a stream clone\ndevice name, a file system object's path name, local and foreign kernel addresses,\nsocket pair information, and a bound vnode address;\n\nor the local and remote mount point names of an NFS file;\n\nor ``STR'', followed by the stream name;\n\nor a stream character device name, followed by ``->'' and the  stream  name  or  a\nlist of stream module names, separated by ``->'';\n\nor  ``STR:''  followed by the SCO OpenServer stream device and module names, sepa‐\nrated by ``->'';\n\nor system directory name, `` -- '', and as many components of  the  path  name  as\nlsof  can  find  in  the kernel's name cache for selected dialects (See the KERNEL\nNAME CACHE section for more information.);\n\nor ``PIPE->'', followed by a Solaris kernel pipe destination address;\n\nor ``COMMON:'', followed by the vnode device information structure's device  name,\nfor a Solaris common vnode;\n\nor the address family, followed by a slash (`/'), followed by fourteen comma-sepa‐\nrated bytes of a non-Internet raw socket address;\n\nor  the  HP-UX  x.25  local address, followed by the virtual connection number (if\nany), followed by the remote address (if any);\n\nor ``(dead)'' for disassociated Tru64 UNIX files - typically terminal  files  that\nhave been flagged with the TIOCNOTTY ioctl and closed by daemons;\n\nor  ``rd=<offset>''  and ``wr=<offset>'' for the values of the read and write off‐\nsets of a FIFO;\n\nor ``clone n:/dev/event'' for SCO OpenServer file clones of the /dev/event device,\nwhere n is the minor device number of the file;\n\nor ``(socketpair: n)'' for a Solaris 2.6, 8, 9  or 10 UNIX domain socket,  created\nby the socketpair(3N) network function;\n\nor  ``no  PCB'' for socket files that do not have a protocol block associated with\nthem, optionally followed by ``, CANTSENDMORE'' if sending on the socket has  been\ndisabled, or ``, CANTRCVMORE'' if receiving on the socket has been disabled (e.g.,\nby the shutdown(2) function);\n\nor  the  local  and  remote  addresses  of  a  Linux  IPX  socket file in the form\n<net>:[<node>:]<port>, followed in parentheses by the transmit and  receive  queue\nsizes, and the connection state;\n\nor  ``dgram''  or  ``stream'' for the type UnixWare 7.1.1 and above in-kernel UNIX\ndomain sockets, followed by a colon (':') and the local path name when  available,\nfollowed  by ``->'' and the remote path name or kernel socket address in hexadeci‐\nmal when available;\n\nor the association value, association index, endpoint value, local address,  local\nport, remote address and remote port for Linux SCTP sockets;\n\nor ``protocol: '' followed by the Linux socket's protocol attribute.\n\nFor  dialects  that support a ``namefs'' file system, allowing one file to be attached to an‐\nother with fattach(3C), lsof will add ``(FA:<address1><direction><address2>)''  to  the  NAME\ncolumn.   <address1>  and  <address2>  are  hexadecimal vnode addresses.  <direction> will be\n``<-'' if <address2> has been fattach'ed to this  vnode  whose  address  is  <address1>;  and\n``->''  if  <address1>,  the  vnode address of this vnode, has been fattach'ed to <address2>.\n<address1> may be omitted if it already appears in the DEVICE column.\n\nLsof may add two parenthetical notes to the NAME column for open Solaris 10 files: ``(?)'' if\nlsof considers the path name of questionable accuracy; and ``(deleted)'' if the -X option has\nbeen specified and lsof detects the open file's path name has been deleted.  Consult the lsof\nFAQ (The FAQ section gives its location.)  for more information on these  NAME  column  addi‐\ntions.\n",
            "subsections": []
        },
        "LOCKS": {
            "content": "Lsof  can't adequately report the wide variety of UNIX dialect file locks in a single charac‐\nter.  What it reports in a single character is a compromise between the information it  finds\nin the kernel and the limitations of the reporting format.\n\nMoreover, when a process holds several byte level locks on a file, lsof only reports the sta‐\ntus  of  the  first  lock it encounters.  If it is a byte level lock, then the lock character\nwill be reported in lower case - i.e., `r', `w', or `x' - rather than the upper case  equiva‐\nlent reported for a full file lock.\n\nGenerally lsof can only report on locks held by local processes on local files.  When a local\nprocess  sets  a  lock on a remotely mounted (e.g., NFS) file, the remote server host usually\nrecords the lock state.  One exception is Solaris - at some patch levels of 2.3, and  in  all\nversions  above  2.4,  the Solaris kernel records information on remote locks in local struc‐\ntures.\n\nLsof has trouble reporting locks for some UNIX dialects.  Consult the BUGS  section  of  this\nmanual page or the lsof FAQ (The FAQ section gives its location.)  for more information.\n",
            "subsections": []
        },
        "OUTPUT FOR OTHER PROGRAMS": {
            "content": "When  the -F option is specified, lsof produces output that is suitable for processing by an‐\nother program - e.g, an awk or Perl script, or a C program.\n\nEach unit of information is output in a field that is identified with a leading character and\nterminated by a NL (012) (or a NUL (000) if the 0 (zero) field identifier character is speci‐\nfied.)  The data of the field follows immediately after the  field  identification  character\nand extends to the field terminator.\n\nIt  is possible to think of field output as process and file sets.  A process set begins with\na field whose identifier is `p' (for process IDentifier (PID)).  It extends to the  beginning\nof  the next PID field or the beginning of the first file set of the process, whichever comes\nfirst.  Included in the process set are fields that identify the command, the  process  group\nIDentification (PGID) number, the task (thread) ID (TID), and the user ID (UID) number or lo‐\ngin name.\n\nA file set begins with a field whose identifier is `f' (for file descriptor).  It is followed\nby lines that describe the file's access mode, lock state, type, device, size, offset, inode,\nprotocol,  name  and  stream  module  names.  It extends to the beginning of the next file or\nprocess set, whichever comes first.\n\nWhen the NUL (000) field terminator has been selected with  the  0  (zero)  field  identifier\ncharacter, lsof ends each process and file set with a NL (012) character.\n\nLsof  always  produces  one  field, the PID (`p') field.  In repeat mode, the marker (`m') is\nalso produced.  All other fields may be declared optionally in the field identifier character\nlist that follows the -F option.  When a field selection character identifies  an  item  lsof\ndoes  not normally list - e.g., PPID, selected with -R - specification of the field character\n- e.g., ``-FR'' - also selects the listing of the item.\n\nLsof version from 4.88 to 4.93.2 always produced one more field, the  file  descriptor  (`f')\nfield.  However,  lsof  in this version doesn't produce it. This change is for supporting the\nuse case that a user needs only the PID field, and doesn't need the  file  descriptor  field.\nSpecify `f' explicitly if you need the field.\n\nIt is entirely possible to select a set of fields that cannot easily be parsed - e.g., if the\nfield  descriptor  field is not selected, it may be difficult to identify file sets.  To help\nyou avoid this difficulty, lsof supports the -F option; it selects the output of  all  fields\nwith  NL  terminators (the -F0 option pair selects the output of all fields with NUL termina‐\ntors).  For compatibility reasons neither -F nor -F0 select the raw device field.\n\nThese are the fields that lsof will produce.  The single character listed first is the  field\nidentifier.\n\na    file access mode\nc    process command name (all characters from proc or\nuser structure)\nC    file structure share count\nd    file's device character code\nD    file's major/minor device number (0x<hexadecimal>)\nf    file descriptor\nF    file structure address (0x<hexadecimal>)\nG    file flaGs (0x<hexadecimal>; names if +fg follows)\ng    process group ID\ni    file's inode number\nK    tasK ID\nk    link count\nl    file's lock status\nL    process login name\nm    marker between repeated output (always selected in repeat mode)\nM    the task comMand name\nn    file name, comment, Internet address\nN    node identifier (ox<hexadecimal>\no    file's offset (0t<decimal> or 0x<hexadecimal>, see -o o)\np    process ID (always selected)\nP    protocol name\nr    raw device number (0x<hexadecimal>)\nR    parent process ID\ns    file's size (decimal)\nS    file's stream identification\nt    file's type\nT    TCP/TPI information, identified by prefixes (the\n`=' is part of the prefix):\nQR=<read queue size>\nQS=<send queue size>\nSO=<socket options and values> (not all dialects)\nSS=<socket states> (not all dialects)\nST=<connection state>\nTF=<TCP flags and values> (not all dialects)\nWR=<window read size>  (not all dialects)\nWW=<window write size>  (not all dialects)\n(TCP/TPI information isn't reported for all supported\nUNIX dialects. The -h or -? help output for the\n-T option will show what TCP/TPI reporting can be\nrequested.)\nu    process user ID\nz    Solaris 10 and higher zone name\nZ    SELinux security context (inhibited when SELinux is disabled)\n0    use NUL field terminator character in place of NL\n1-9  dialect-specific field identifiers (The output\nof -F? identifies the information to be found\nin dialect-specific fields.)\n\nYou can get on-line help information on these characters and their descriptions by specifying\nthe  -F?  option pair.  (Escape the `?' character as your shell requires.)  Additional infor‐\nmation on field content can be found in the OUTPUT section.\n\nAs an example, ``-F pcfn'' will select the process ID (`p'), command  name  (`c'),  file  de‐\nscriptor (`f') and file name (`n') fields with an NL field terminator character; ``-F pcfn0''\nselects the same output with a NUL (000) field terminator character.\n\nLsof doesn't produce all fields for every process or file set, only those that are available.\nSome  fields  are mutually exclusive: file device characters and file major/minor device num‐\nbers; file inode number and protocol name; file name and stream identification; file size and\noffset.  One or the other member of these mutually exclusive sets will appear in  field  out‐\nput, but not both.\n\nNormally lsof ends each field with a NL (012) character.  The 0 (zero) field identifier char‐\nacter may be specified to change the field terminator character to a NUL (000).  A NUL termi‐\nnator  may  be  easier to process with xargs (1), for example, or with programs whose quoting\nmechanisms may not easily cope with the range of characters in the field  output.   When  the\nNUL field terminator is in use, lsof ends each process and file set with a NL (012).\n\nThree  aids to producing programs that can process lsof field output are included in the lsof\ndistribution.  The first is a C header file, lsoffields.h, that  contains  symbols  for  the\nfield identification characters, indexes for storing them in a table, and explanation strings\nthat may be compiled into programs.  Lsof uses this header file.\n\nThe  second aid is a set of sample scripts that process field output, written in awk, Perl 4,\nand Perl 5.  They're located in the scripts subdirectory of the lsof distribution.\n\nThe third aid is the C library used for the lsof test suite.  The test suite is written in  C\nand uses field output to validate the correct operation of lsof.  The library can be found in\nthe  tests/LTlib.c  file  of  the  lsof  distribution.   The  library uses the first aid, the\nlsoffields.h header file.\n",
            "subsections": []
        },
        "BLOCKS AND TIMEOUTS": {
            "content": "Lsof can be blocked by some kernel functions  that  it  uses  -  lstat(2),  readlink(2),  and\nstat(2).   These  functions  are  stalled  in  the  kernel, for example, when the hosts where\nmounted NFS file systems reside become inaccessible.\n\nLsof attempts to break these blocks with timers and child processes, but the  techniques  are\nnot  wholly  reliable.  When lsof does manage to break a block, it will report the break with\nan error message.  The messages may be suppressed with the -t and -w options.\n\nThe default timeout value may be displayed with the -h or -?  option, and it may  be  changed\nwith the -S [t] option.  The minimum for t is two seconds, but you should avoid small values,\nsince  slow system responsiveness can cause short timeouts to expire unexpectedly and perhaps\nstop lsof before it can produce any output.\n\nWhen lsof has to break a block during its access of mounted file system information, it  nor‐\nmally continues, although with less information available to display about open files.\n\nLsof  can  also  be directed to avoid the protection of timers and child processes when using\nthe kernel functions that might block by specifying the -O option.   While  this  will  allow\nlsof to start up with less overhead, it exposes lsof completely to the kernel situations that\nmight block it.  Use this option cautiously.\n",
            "subsections": []
        },
        "AVOIDING KERNEL BLOCKS": {
            "content": "You  can  use  the  -b  option to tell lsof to avoid using kernel functions that would block.\nSome cautions apply.\n\nFirst, using this option usually requires that your system supply alternate device numbers in\nplace of the device numbers that lsof would normally obtain with  the  lstat(2)  and  stat(2)\nkernel functions.  See the ALTERNATE DEVICE NUMBERS section for more information on alternate\ndevice numbers.\n\nSecond, you can't specify names for lsof to locate unless they're file system names.  This is\nbecause  lsof  needs  to  know the device and inode numbers of files listed with names in the\nlsof options, and the -b option prevents lsof from obtaining them.  Moreover, since lsof only\nhas device numbers for the file systems that have alternates, its ability to locate files  on\nfile  systems  depends  completely on the availability and accuracy of the alternates.  If no\nalternates are available, or if they're incorrect, lsof won't be able to locate files on  the\nnamed file systems.\n\nThird,  if  the  names  of  your file system directories that lsof obtains from your system's\nmount table are symbolic links, lsof won't be able to resolve the links.  This is because the",
            "subsections": [
                {
                    "name": "-b",
                    "content": "links.\n\nFinally,  using  the -b option causes lsof to issue warning messages when it needs to use the\nkernel functions that the -b option directs it to avoid.  You can suppress these messages  by\nspecifying  the -w option, but if you do, you won't see the alternate device numbers reported\nin the warning messages.\n",
                    "flag": "-b"
                }
            ]
        },
        "ALTERNATE DEVICE NUMBERS": {
            "content": "On some dialects, when lsof has to break a block because it can't  get  information  about  a\nmounted  file  system via the lstat(2) and stat(2) kernel functions, or because you specified\nthe -b option, lsof can obtain some of the information it needs - the device number and  pos‐\nsibly  the  file system type - from the system mount table.  When that is possible, lsof will\nreport the device number it obtained.  (You can suppress the report by specifying the -w  op‐\ntion.)\n\nYou can assist this process if your mount table is supported with an /etc/mtab or /etc/mnttab\nfile  that  contains an options field by adding a ``dev=xxxx'' field for mount points that do\nnot have one in their options strings.  Note: you must be able to edit the file - i.e.,  some\nmount tables like recent Solaris /etc/mnttab or Linux /proc/mounts are read-only and can't be\nmodified.\n\nYou  may  also  be able to supply device numbers using the +m and +m m options, provided they\nare supported by your dialect.  Check the output of lsof's -h or -?  options to see if the +m\nand +m m options are available.\n\nThe ``xxxx'' portion of the field is the hexadecimal value of the file system's  device  num‐\nber.   (Consult  the stdev field of the output of the lstat(2) and stat(2) functions for the\nappropriate values for your file  systems.)   Here's  an  example  from  a  Sun  Solaris  2.6\n/etc/mnttab for a file system remotely mounted via NFS:\n\nnfs  ignore,noquota,dev=2a40001\n\nThere's  an advantage to having ``dev=xxxx'' entries in your mount table file, especially for\nfile systems that are mounted from remote NFS servers.  When a remote server crashes and  you\nwant to identify its users by running lsof on one of its clients, lsof probably won't be able\nto  get output from the lstat(2) and stat(2) functions for the file system.  If it can obtain\nthe file system's device number from the mount table, it will be able to  display  the  files\nopen on the crashed NFS server.\n\nSome  dialects that do not use an ASCII /etc/mtab or /etc/mnttab file for the mount table may\nstill provide an alternative device number in their internal  mount  tables.   This  includes\nAIX,  Apple  Darwin,  FreeBSD, NetBSD, OpenBSD, and Tru64 UNIX.  Lsof knows how to obtain the\nalternative device number for these dialects and uses it when  its  attempt  to  lstat(2)  or\nstat(2) the file system is blocked.\n\nIf  you're  not sure your dialect supplies alternate device numbers for file systems from its\nmount table, use this lsof incantation to see if it reports any alternate device numbers:\n\nlsof -b\n\nLook for standard error file warning messages that begin ``assuming \"dev=xxxx\" from ...''.\n",
            "subsections": []
        },
        "KERNEL NAME CACHE": {
            "content": "Lsof is able to examine the kernel's name cache or use other kernel facilities (e.g., the AD‐\nVFS 4.x tagtopath() function under Tru64 UNIX) on some dialects for most file system types,\nexcluding AFS, and extract recently used path name components from it.  (AFS file system path\nlookups don't use the kernel's name cache; some Solaris VxFS file  system  operations  appar‐\nently don't use it, either.)\n\nLsof reports the complete paths it finds in the NAME column.  If lsof can't report all compo‐\nnents in a path, it reports in the NAME column the file system name, followed by a space, two\n`-'  characters,  another space, and the name components it has located, separated by the `/'\ncharacter.\n\nWhen lsof is run in repeat mode - i.e., with the -r option specified - the extent to which it\ncan report path name components for the same file may vary from cycle to cycle.   That's  be‐\ncause  other running processes can cause the kernel to remove entries from its name cache and\nreplace them with others.\n\nLsof's use of the kernel name cache to identify the paths of files can lead it to report  in‐\ncorrect components under some circumstances.  This can happen when the kernel name cache uses\ndevice  and  node number as a key (e.g., SCO OpenServer) and a key on a rapidly changing file\nsystem is reused.  If the UNIX dialect's kernel doesn't purge the name cache entry for a file\nwhen it is unlinked, lsof may find a reference to the wrong entry in the cache.  The lsof FAQ\n(The FAQ section gives its location.)  has more information on this situation.\n\nLsof can report path name components for these dialects:\n\nFreeBSD\nHP-UX\nLinux\nNetBSD\nNEXTSTEP\nOpenBSD\nOPENSTEP\nSCO OpenServer\nSCO|Caldera UnixWare\nSolaris\nTru64 UNIX\n\nLsof can't report path name components for these dialects:\n\nAIX\n\nIf you want to know why lsof can't report path name components for  some  dialects,  see  the\nlsof FAQ (The FAQ section gives its location.)\n",
            "subsections": []
        },
        "DEVICE CACHE FILE": {
            "content": "Examining  all members of the /dev (or /devices) node tree with stat(2) functions can be time\nconsuming.  What's more, the information that lsof needs - device number, inode  number,  and\npath - rarely changes.\n\nConsequently,  lsof normally maintains an ASCII text file of cached /dev (or /devices) infor‐\nmation (exception: the /proc-based Linux lsof where it's not needed.)  The local  system  ad‐\nministrator who builds lsof can control the way the device cache file path is formed, select‐\ning from these options:\n\nPath from the -D option;\nPath from an environment variable;\nSystem-wide path;\nPersonal path (the default);\nPersonal path, modified by an environment variable.\n\nConsult the output of the -h, -D? , or -?  help options for the current state of device cache\nsupport.   The  help output lists the default read-mode device cache file path that is in ef‐\nfect for the current invocation of lsof.  The -D?  option  output  lists  the  read-only  and\nwrite  device  cache  file  paths, the names of any applicable environment variables, and the\npersonal device cache path format.\n\nLsof can detect that the current device cache file has been accidentally or maliciously modi‐\nfied by integrity checks, including the computation and verification of a sixteen bit  Cyclic\nRedundancy Check (CRC) sum on the file's contents.  When lsof senses something wrong with the\nfile,  it  issues  a  warning  and attempts to remove the current cache file and create a new\ncopy, but only to a path that the process can legitimately write.\n\nThe path from which a lsof process may attempt to read a device cache file  may  not  be  the\nsame  as the path to which it can legitimately write.  Thus when lsof senses that it needs to\nupdate the device cache file, it may choose a different path for writing  it  from  the  path\nfrom which it read an incorrect or outdated version.\n\nIf  available, the -Dr option will inhibit the writing of a new device cache file.  (It's al‐\nways available when specified without a path name argument.)\n\nWhen a new device is added to the system, the device cache file may  need  to  be  recreated.\nSince  lsof  compares the mtime of the device cache file with the mtime and ctime of the /dev\n(or /devices) directory, it usually detects that a new device has been added;  in  that  case\nlsof issues a warning message and attempts to rebuild the device cache file.\n\nWhenever  lsof  writes a device cache file, it sets its ownership to the real UID of the exe‐\ncuting process, and its permission modes to 0600, this restricting its reading and writing to\nthe file's owner.\n\nLSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS\nTwo permissions of the lsof executable affect its ability to access device cache files.   The\npermissions are set by the local system administrator when lsof is installed.\n\nThe  first  and rarer permission is setuid-root.  It comes into effect when lsof is executed;\nits effective UID is then root, while its real (i.e., that of the logged-on user) UID is not.\nThe lsof distribution recommends that versions for these dialects run setuid-root.\n\nHP-UX 11.11 and 11.23\nLinux\n\nThe second and more common permission is setgid.  It comes into  effect  when  the  effective\ngroup  IDentification  number  (GID) of the lsof process is set to one that can access kernel\nmemory devices - e.g., ``kmem'', ``sys'', or ``system''.\n\nAn lsof process that has setgid permission usually surrenders the permission after it has ac‐\ncessed the kernel memory devices.  When it does that, lsof  can  allow  more  liberal  device\ncache path formations.  The lsof distribution recommends that versions for these dialects run\nsetgid and be allowed to surrender setgid permission.\n\nAIX 5.[12] and 5.3-ML1\nApple Darwin 7.x Power Macintosh systems\nFreeBSD 4.x, 4.1x, 5.x and [6789].x for x86-based systems\nFreeBSD 5.x, [6789].x and 1[012].8for Alpha, AMD64 and Sparc64\nbased systems\nHP-UX 11.00\nNetBSD 1.[456], 2.x and 3.x for Alpha, x86, and SPARC-based\nsystems\nNEXTSTEP 3.[13] for NEXTSTEP architectures\nOpenBSD 2.[89] and 3.[0-9] for x86-based systems\nOPENSTEP 4.x\nSCO OpenServer Release 5.0.6 for x86-based systems\nSCO|Caldera UnixWare 7.1.4 for x86-based systems\nSolaris 2.6, 8, 9 and 10\nTru64 UNIX 5.1\n\n(Note: lsof for AIX 5L and above needs setuid-root permission if its -X option is used.)\n\nLsof for these dialects does not support a device cache, so the permissions given to the exe‐\ncutable don't apply to the device cache file.\n\nLinux\n",
            "subsections": []
        },
        "DEVICE CACHE FILE PATH FROM THE -D OPTION": {
            "content": "The -D option provides limited means for specifying the device cache file path.  Its ?  func‐\ntion will report the read-only and write device cache file paths that lsof will use.\n\nWhen  the  -D b, r, and u functions are available, you can use them to request that the cache\nfile be built in a specific location (b[path]); read but not rebuilt (r[path]); or  read  and\nrebuilt (u[path]).  The b, r, and u functions are restricted under some conditions.  They are\nrestricted  when  the lsof process is setuid-root.  The path specified with the r function is\nalways read-only, even when it is available.\n\nThe b, r, and u functions are also restricted when the lsof  process  runs  setgid  and  lsof\ndoesn't  surrender the setgid permission.  (See the LSOF PERMISSIONS THAT AFFECT DEVICE CACHE\nFILE ACCESS section for a list of implementations that normally don't surrender their  setgid\npermission.)\n\nA further -D function, i (for ignore), is always available.\n\nWhen available, the b function tells lsof to read device information from the kernel with the\nstat(2) function and build a device cache file at the indicated path.\n\nWhen  available,  the r function tells lsof to read the device cache file, but not update it.\nWhen a path argument accompanies -Dr, it names the device cache file path.  The r function is\nalways available when it is specified without a path name argument.  If lsof is  not  running\nsetuid-root  and  surrenders  its setgid permission, a path name argument may accompany the r\nfunction.\n\nWhen available, the u function tells lsof to attempt to read and use the device  cache  file.\nIf  it can't read the file, or if it finds the contents of the file incorrect or outdated, it\nwill read information from the kernel, and attempt to write an updated version of the  device\ncache  file,  but  only  to a path it considers legitimate for the lsof process effective and\nreal UIDs.\n",
            "subsections": []
        },
        "DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE": {
            "content": "Lsof's second choice for the device cache file is the contents of the  LSOFDEVCACHE  environ‐\nment  variable.  It avoids this choice if the lsof process is setuid-root, or the real UID of\nthe process is root.\n\nA further restriction applies to a device cache file path taken from the  LSOFDEVCACHE  envi‐\nronment  variable:  lsof  will  not write a device cache file to the path if the lsof process\ndoesn't surrender its setgid permission.  (See the LSOF PERMISSIONS THAT AFFECT DEVICE  CACHE\nFILE ACCESS section for information on implementations that don't surrender their setgid per‐\nmission.)\n\nThe  local  system administrator can disable the use of the LSOFDEVCACHE environment variable\nor change its name when building lsof.  Consult the output of -D?  for the environment  vari‐\nable's name.\n",
            "subsections": []
        },
        "SYSTEM-WIDE DEVICE CACHE PATH": {
            "content": "The local system administrator may choose to have a system-wide device cache file when build‐\ning  lsof.  That file will generally be constructed by a special system administration proce‐\ndure when the system is booted or when the contents of /dev or  /devices)  changes.   If  de‐\nfined, it is lsof's third device cache file path choice.\n\nYou can tell that a system-wide device cache file is in effect for your local installation by\nexamining the lsof help option output - i.e., the output from the -h or -?  option.\n\nLsof  will  never write to the system-wide device cache file path by default.  It must be ex‐\nplicitly named with a -D function in a root-owned procedure.  Once the file has been written,\nthe procedure  must  change  its  permission  modes  to  0644  (owner-read  and  owner-write,\ngroup-read, and other-read).\n\nPERSONAL DEVICE CACHE PATH (DEFAULT)\nThe  default  device cache file path of the lsof distribution is one recorded in the home di‐\nrectory of the real UID that executes lsof.  Added to the home directory  is  a  second  path\ncomponent of the form .lsofhostname.\n\nThis  is  lsof's fourth device cache file path choice, and is usually the default.  If a sys‐\ntem-wide device cache file path was defined when lsof was built, this fourth choice  will  be\napplied  when  lsof can't find the system-wide device cache file.  This is the only time lsof\nuses two paths when reading the device cache file.\n\nThe hostname part of the second component is the base name of the executing host, as returned\nby gethostname(2).  The base name is defined to be the characters preceding the first `.'  in\nthe gethostname(2) output, or all the gethostname(2) output if it contains no `.'.\n\nThe device cache file belongs to the user ID and is readable and  writable  by  the  user  ID\nalone  -  i.e., its modes are 0600.  Each distinct real user ID on a given host that executes\nlsof has a distinct device cache file.  The hostname part of the  path  distinguishes  device\ncache  files  in an NFS-mounted home directory into which device cache files are written from\nseveral different hosts.\n\nThe personal device cache file path formed by this method represents a device cache file that\nlsof will attempt to read, and will attempt to write should it not exist or should  its  con‐\ntents be incorrect or outdated.\n\nThe  -Dr  option  without a path name argument will inhibit the writing of a new device cache\nfile.\n\nThe -D?  option will list the format specification for constructing the personal device cache\nfile.  The conversions used in the format specification are described in the 00DCACHE file of\nthe lsof distribution.\n",
            "subsections": []
        },
        "MODIFIED PERSONAL DEVICE CACHE PATH": {
            "content": "If this option is defined by the local system administrator when lsof is built, the LSOFPERS‐\nDCPATH environment variable contents may be used to add a component of  the  personal  device\ncache file path.\n\nThe  LSOFPERSDCPATH variable contents are inserted in the path at the place marked by the lo‐\ncal system administrator with the ``%p'' conversion in the HASPERSDC format specification  of\nthe  dialect's machine.h header file.  (It's placed right after the home directory in the de‐\nfault lsof distribution.)\n\nThus, for example, if LSOFPERSDCPATH contains ``LSOF'', the home directory is ``/Homes/abe'',\nthe  host  name  is  ``lsof.itap.purdue.edu'',  and  the  HASPERSDC  format  is  the  default\n(``%h/%p.lsof%L''), the modified personal device cache file path is:\n\n/Homes/abe/LSOF/.lsofvic\n\nThe  LSOFPERSDCPATH  environment  variable is ignored when the lsof process is setuid-root or\nwhen the real UID of the process is root.\n\nLsof will not write to a modified personal device cache file path if the lsof process doesn't\nsurrender setgid permission.  (See the LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE  ACCESS\nsection for a list of implementations that normally don't surrender their setgid permission.)\n\nIf,  for  example,  you want to create a sub-directory of personal device cache file paths by\nusing the LSOFPERSDCPATH environment variable to name it, and lsof doesn't surrender its set‐\ngid permission, you will have to allow lsof to create device cache files at the standard per‐\nsonal path and move them to your subdirectory with shell commands.\n\nThe local system administrator may: disable this option when lsof is built; change  the  name\nof  the environment variable from LSOFPERSDCPATH to something else; change the HASPERSDC for‐\nmat to include the personal path component in another place; or  exclude  the  personal  path\ncomponent  entirely.   Consult  the  output of the -D?  option for the environment variable's\nname and the HASPERSDC format specification.\n",
            "subsections": []
        },
        "DIAGNOSTICS": {
            "content": "Errors are identified with messages on the standard error file.\n\nLsof returns a one (1) if any error was detected, including the  failure  to  locate  command\nnames,  file names, Internet addresses or files, login names, NFS files, PIDs, PGIDs, or UIDs\nit was asked to list.  If the -V option is specified, lsof will indicate the search items  it\nfailed to list.  If the -Q option is specified, lsof will ignore any search item failures and\nonly return an error if something unusual and unrecoverable happened.\n\nIt returns a zero (0) if no errors were detected and if either the -Q option was specified or\nit was able to list some information about all the specified search arguments.\n\nWhen  lsof  cannot open access to /dev (or /devices) or one of its subdirectories, or get in‐\nformation on a file in them with stat(2), it issues a warning message  and  continues.   That\nlsof  will issue warning messages about inaccessible files in /dev (or /devices) is indicated\nin its help output - requested with the -h or >B -?  options -  with the message:\n\nInaccessible /dev warnings are enabled.\n\nThe warning message may be suppressed with the -w option.  It may also have  been  suppressed\nby the system administrator when lsof was compiled by the setting of the WARNDEVACCESS defin‐\nition.  In this case, the output from the help options will include the message:\n\nInaccessible /dev warnings are disabled.\n\nInaccessible  device  warning messages usually disappear after lsof has created a working de‐\nvice cache file.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "For a more extensive set of examples, documented more fully, see the 00QUICKSTART file of the\nlsof distribution.\n\nTo list all open files, use:\n\nlsof\n\nTo list all open Internet, x.25 (HP-UX), and UNIX domain files, use:\n\nlsof -i -U\n\nTo list all open IPv4 network files in use by the process whose PID is 1234, use:\n\nlsof -i 4 -a -p 1234\n\nIf it's okay for PID 1234 to not exist, or for PID 1234 to not have  any  open  IPv4  network\nfiles, add -Q :\n\nlsof -Q -i 4 -a -p 1234\n\nPresuming the UNIX dialect supports IPv6, to list only open IPv6 network files, use:\n\nlsof -i 6\n\nTo  list  all  files  using any protocol on ports 513, 514, or 515 of host wonderland.cc.pur‐\ndue.edu, use:\n\nlsof -i @wonderland.cc.purdue.edu:513-515\n\nTo list all files using any protocol on any port of mace.cc.purdue.edu (cc.purdue.edu is  the\ndefault domain), use:\n\nlsof -i @mace\n\nTo  list  all  open files for login name ``abe'', or user ID 1234, or process 456, or process\n123, or process 789, use:\n\nlsof -p 456,123,789 -u 1234,abe\n\nTo list all open files on device /dev/hd4, use:\n\nlsof /dev/hd4\n\nTo find the process that has /u/abe/foo open without worrying if there are none, use:\n\nlsof -Q /u/abe/foo\n\nTo take action only if a process has /u/abe/foo open, use:\n\nlsof /u/abe/foo  echo \"still in use\"\n\nTo send a SIGHUP to the processes that have /u/abe/bar open, use:\n\nkill -HUP `lsof -t /u/abe/bar`\n\nTo find any open file, including an open UNIX domain socket file,  with  the  name  /dev/log,\nuse:\n\nlsof /dev/log\n\nTo  find processes with open files on the NFS file system named /nfs/mount/point whose server\nis  inaccessible,  and  presuming  your  mount  table  supplies   the   device   number   for\n/nfs/mount/point, use:\n\nlsof -b /nfs/mount/point\n\nTo do the preceding search with warning messages suppressed, use:\n\nlsof -bw /nfs/mount/point\n\nTo ignore the device cache file, use:\n\nlsof -Di\n\nTo  obtain  PID  and command name field output for each process, file descriptor, file device\nnumber, and file inode number for each file of each process, use:\n\nlsof -FpcfDi\n\nTo list the files at descriptors 1 and 3 of every process running the lsof command for  login\nID ``abe'' every 10 seconds, use:\n\nlsof -c lsof -a -d 1 -d 3 -u abe -r10\n\nTo  list  the  current  working directory of processes running a command that is exactly four\ncharacters long and has an 'o' or 'O' in character three, use this regular expression form of\nthe -c c option:\n\nlsof -c /^..o.$/i -a -d cwd\n\nTo find an IP version 4 socket file by its associated numeric dot-form address, use:\n\nlsof -i@128.210.15.17\n\nTo find an IP version 6 socket file (when the UNIX dialect supports IPv6) by  its  associated\nnumeric colon-form address, use:\n\nlsof -i@[0:1:2:3:4:5:6:7]\n\nTo  find  an  IP version 6 socket file (when the UNIX dialect supports IPv6) by an associated\nnumeric colon-form address that has a run of zeroes in it - e.g.,  the  loop-back  address  -\nuse:\n\nlsof -i@[::1]\n\nTo obtain a repeat mode marker line that contains the current time, use:\n\nlsof -rm====%T====\n\nTo add spaces to the previous marker line, use:\n\nlsof -r \"m==== %T ====\"\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Since  lsof  reads kernel memory in its search for open files, rapid changes in kernel memory\nmay produce unpredictable results.\n\nWhen a file has multiple record locks, the lock status character (following the file descrip‐\ntor) is derived from a test of the first lock structure, not from any combination of the  in‐\ndividual record locks that might be described by multiple lock structures.\n\nLsof  can't  search  for  files  with restrictive access permissions by name unless it is in‐\nstalled with root set-UID permission.  Otherwise it is limited  to  searching  for  files  to\nwhich its user or its set-GID group (if any) has access permission.\n\nThe  display  of the destination address of a raw socket (e.g., for ping) depends on the UNIX\noperating system.  Some dialects store the destination address in the raw  socket's  protocol\ncontrol block, some do not.\n\nLsof  can't always represent Solaris device numbers in the same way that ls(1) does.  For ex‐\nample, the major and minor device numbers that the lstat(2) and stat(2) functions report  for\nthe  directory  on  which CD-ROM files are mounted (typically /cdrom) are not the same as the\nones that it reports for the device on which CD-ROM files are mounted  (typically  /dev/sr0).\n(Lsof reports the directory numbers.)\n\nThe  support for /proc file systems is available only for BSD and Tru64 UNIX dialects, Linux,\nand dialects derived from SYSV R4 - e.g., FreeBSD, NetBSD, OpenBSD, Solaris, UnixWare.\n\nSome /proc file items - device number, inode number, and file size - are unavailable in  some\ndialects.   Searching for files in a /proc file system may require that the full path name be\nspecified.\n\nNo text (txt) file descriptors are displayed for Linux  processes.   All  entries  for  files\nother  than the current working directory, the root directory, and numerical file descriptors\nare labeled mem descriptors.\n\nLsof can't search for Tru64 UNIX named pipes by name, because their kernel implementation  of\nlstat(2) returns an improper device number for a named pipe.\n\nLsof  can't report fully or correctly on HP-UX 9.01, 10.20, and 11.00 locks because of insuf‐\nficient access to kernel data or errors in the kernel data.  See the lsof FAQ (The  FAQ  sec‐\ntion gives its location.)  for details.\n\nThe  AIX  SMT  file  type is a fabrication.  It's made up for file structures whose type (15)\nisn't defined in the AIX /usr/include/sys/file.h header file.  One way to  create  such  file\nstructures is to run X clients with the DISPLAY variable set to ``:0.0''.\n\nThe  +|-f[cfn]  option is not supported under /proc-based Linux lsof, because it doesn't read\nkernel structures from kernel memory.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "Lsof may access these environment variables.\n\nLANG              defines a language locale.  See setlocale(3) for the names of  other  vari‐\nables that can be used in place of LANG - e.g., LCALL, LCTYPE, etc.\n\nLSOFDEVCACHE      defines the path to a device cache file.  See the DEVICE CACHE PATH FROM AN\nENVIRONMENT VARIABLE section for more information.\n\nLSOFPERSDCPATH    defines the middle component of a modified personal device cache file path.\nSee the MODIFIED PERSONAL DEVICE CACHE PATH section for more information.\n",
            "subsections": []
        },
        "FAQ": {
            "content": "Frequently-asked  questions and their answers (an FAQ) are available in the 00FAQ file of the\nlsof distribution.\n\nThat latest version of the file is found at:\n\nhttps://github.com/lsof-org/lsof/blob/master/00FAQ\n",
            "subsections": []
        },
        "FILES": {
            "content": "/dev/kmem         kernel virtual memory device\n\n/dev/mem          physical memory device\n\n/dev/swap         system paging device\n\n.lsofhostname    lsof's device cache file (The suffix, hostname, is the first  component  of\nthe host's name returned by gethostname(2).)\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Lsof  was  written  by  Victor  A.Abell <abe@purdue.edu> of Purdue University.  Since version\n4.93.0, the lsof-org team at GitHub maintains lsof.  Many others have  contributed  to  lsof.\nThey're listed in the 00CREDITS file of the lsof distribution.\n",
            "subsections": []
        },
        "DISTRIBUTION": {
            "content": "The latest distribution of lsof is available at\n\nhttps://github.com/lsof-org/lsof/releases\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Not  all  the  following  manual pages may exist in every UNIX dialect to which lsof has been\nported.\n\naccess(2), awk(1), crash(1), fattach(3C),  ff(1),  fstat(8),  fuser(1),  gethostname(2),  is‐\nprint(3),  kill(1),  localtime(3),  lstat(2),  modload(8),  mount(8), netstat(1), ofiles(8L),\nopen(2), perl(1), ps(1), readlink(2), setlocale(3), stat(2), strftime(3), time(2), uname(1).\n\nRevision-4.95.0                                   LSOF(8)",
            "subsections": []
        }
    },
    "summary": "lsof - list open files",
    "flags": [
        {
            "flag": "-u",
            "long": null,
            "arg": null,
            "description": "ther login ``fff'' OR ``ggg'' AND have network connections to either host aaa.bbb OR ccc.ddd. Options may be grouped together following a single prefix -- e.g., the option set ``-a -b"
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "+|-L, -o, +|-r, -s, -S, -T, -x and -z. when you have no values for them be careful that the following character isn't ambiguous. For example, -Fn might represent the -F and -n options, or it might represent the n field identifier character following the -F option. When ambigu‐ ity is possible, start a new option with a `-' character - e.g., ``-F -n''. If the next op‐ tion is a file name, follow the possibly ambiguous option with ``--'' - e.g., ``-F -- name''. Either the `+' or the `-' prefix may be applied to a group of options. Options that don't take on separate meanings for each prefix - e.g., -i - may be grouped under either prefix. Thus, for example, ``+M -i'' may be stated as ``+Mi'' and the group means the same as the separate options. Be careful of prefix grouping when one or more options in the group does take on separate meanings under different prefixes - e.g., +|-M; ``-iM'' is not the same re‐ quest as ``-i +M''. When in doubt, use separate options with appropriate prefixes. -? -h These two equivalent options select a usage (help) output list. Lsof displays a shortened form of this output when it detects an error in the options supplied to it, after it has displayed messages explaining each error. (Escape the `?' charac‐ ter as your shell requires.)"
        },
        {
            "flag": "-a",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-A",
            "long": null,
            "arg": null,
            "description": "dynamic modules. It allows the lsof user to specify A as an alternate name list file where the kernel addresses of the dynamic modules might be found. See the lsof FAQ (The FAQ section gives its location.) for more information about dynamic mod‐ ules, their symbols, and how they affect lsof."
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": "stat(2). See the BLOCKS AND TIMEOUTS and AVOIDING KERNEL BLOCKS sections for information on using this option."
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "the characters of c. Multiple commands may be specified, using multiple -c options. They are joined in a single ORed set before participating in AND option selection. If c begins with a `^', then the following characters specify a command name whose processes are to be ignored (excluded.) If c begins and ends with a slash ('/'), the characters between the slashes are in‐ terpreted as a regular expression. Shell meta-characters in the regular expression must be quoted to prevent their interpretation by the shell. The closing slash may be followed by these modifiers: b the regular expression is a basic one. i ignore the case of letters. x the regular expression is an extended one (default). See the lsof FAQ (The FAQ section gives its location.) for more information on ba‐ sic and extended regular expressions. The simple command specification is tested first. If that test fails, the command regular expression is applied. If the simple command test succeeds, the command regular expression test isn't made. This may result in ``no command found for regex:'' messages when lsof's -V option is specified. +c w defines the maximum number of initial characters of the name, supplied by the UNIX dialect, of the UNIX command associated with a process to be printed in the COMMAND column. (The lsof default is nine.) Note that many UNIX dialects do not supply all command name characters to lsof in the files and structures from which lsof obtains command name. Often dialects limit the number of characters supplied in those sources. For example, Linux 2.4.27 and Solaris 9 both limit command name length to 16 characters. If w is zero ('0'), all command characters supplied to lsof by the UNIX dialect will be printed. If w is less than the length of the column title, ``COMMAND'', it will be raised to that length."
        },
        {
            "flag": "-C",
            "long": null,
            "arg": null,
            "description": "See the KERNEL NAME CACHE section for more information. +d s causes lsof to search for all open instances of directory s and the files and direc‐ tories it contains at its top level. +d does NOT descend the directory tree, rooted at s. The +D D option may be used to request a full-descent directory tree search, rooted at directory D. Processing of the +d option does not follow symbolic links within s unless the -x or -x l option is also specified. Nor does it search for open files on file system mount points on subdirectories of s unless the -x or -x f option is also specified. Note: the authority of the user of this option limits it to searching for files that the user has permission to examine with the system stat(2) function."
        },
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": "listing. The file descriptors are specified in the comma-separated set s - e.g., ``cwd,1,3'', ``^6,^2''. (There should be no spaces in the set.) The list is an exclusion list if all entries of the set begin with `^'. It is an inclusion list if no entry begins with `^'. Mixed lists are not permitted. A file descriptor number range may be in the set as long as neither member is empty, both members are numbers, and the ending member is larger than the starting one - e.g., ``0-7'' or ``3-10''. Ranges may be specified for exclusion if they have the `^' prefix - e.g., ``^0-7'' excludes all file descriptors 0 through 7. Multiple file descriptor numbers are joined in a single ORed set before participat‐ ing in AND option selection. When there are exclusion and inclusion members in the set, lsof reports them as er‐ rors and exits with a non-zero return code. See the description of File Descriptor (FD) output values in the OUTPUT section for more information on file descriptor names. fd is a pseudo file descriptor name for specifying the whole range of possible file descriptor numbers. fd does not appear in FD column of output. +D D causes lsof to search for all open instances of directory D and all the files and directories it contains to its complete depth. Processing of the +D option does not follow symbolic links within D unless the -x or -x l option is also specified. Nor does it search for open files on file system mount points on subdirectories of D unless the -x or -x f option is also specified. Note: the authority of the user of this option limits it to searching for files that the user has permission to examine with the system stat(2) function. Further note: lsof may process this option slowly and require a large amount of dy‐ namic memory to do it. This is because it must descend the entire directory tree, rooted at D, calling stat(2) for each file and directory, building a list of all the files it finds, and searching that list for a match with every open file. When di‐ rectory D is large, these steps can take a long time, so use this option prudently."
        },
        {
            "flag": "-D",
            "long": null,
            "arg": null,
            "description": "restricted. See the DEVICE CACHE FILE section and the sections that follow it for more information on this option. -D must be followed by a function letter; the function letter may optionally be fol‐ lowed by a path name. Lsof recognizes these function letters: ? - report device cache file paths b - build the device cache file i - ignore the device cache file r - read the device cache file u - read and update the device cache file The b, r, and u functions, accompanied by a path name, are sometimes restricted. When these functions are restricted, they will not appear in the description of the -D option that accompanies -h or -? option output. See the DEVICE CACHE FILE sec‐ tion and the sections that follow it for more information on these functions and when they're restricted. The ? function reports the read-only and write paths that lsof can use for the de‐ vice cache file, the names of any environment variables whose values lsof will exam‐ ine when forming the device cache file path, and the format for the personal device cache file path. (Escape the `?' character as your shell requires.) When available, the b, r, and u functions may be followed by the device cache file's path. The standard default is .lsofhostname in the home directory of the real user ID that executes lsof, but this could have been changed when lsof was configured and compiled. (The output of the -h and -? options show the current default prefix - e.g., ``.lsof''.) The suffix, hostname, is the first component of the host's name returned by gethostname(2). When available, the b function directs lsof to build a new device cache file at the default or specified path. The i function directs lsof to ignore the default device cache file and obtain its information about devices via direct calls to the kernel. The r function directs lsof to read the device cache at the default or specified path, but prevents it from creating a new device cache file when none exists or the existing one is improperly structured. The r function, when specified without a path name, prevents lsof from updating an incorrect or outdated device cache file, or creating a new one in its place. The r function is always available when it is specified without a path name argument; it may be restricted by the permissions of the lsof process. When available, the u function directs lsof to read the device cache file at the de‐ fault or specified path, if possible, and to rebuild it, if necessary. This is the default device cache file function when no -D option has been specified. +|-e s exempts the file system whose path name is s from being subjected to kernel function calls that might block. The +e option exempts stat(2), lstat(2) and most read‐ link(2) kernel function calls. The -e option exempts only stat(2) and lstat(2) ker‐ nel function calls. Multiple file systems may be specified with separate +|-e spec‐ ifications and each may have readlink(2) calls exempted or not. This option is currently implemented only for Linux. CAUTION: this option can easily be mis-applied to other than the file system of in‐ terest, because it uses path name rather than the more reliable device and inode numbers. (Device and inode numbers are acquired via the potentially blocking stat(2) kernel call and are thus not available, but see the +|-m m option as a pos‐ sible alternative way to supply device numbers.) Use this option with great care and fully specify the path name of the file system to be exempted. When open files on exempted file systems are reported, it may not be possible to ob‐ tain all their information. Therefore, some information columns will be blank, the characters ``UNKN'' preface the values in the TYPE column, and the applicable exemp‐ tion option is added in parentheses to the end of the NAME column. (Some device number information might be made available via the +|-m m option.) +|-E +E specifies that Linux pipe, Linux UNIX socket, Linux INET(6) socket closed in a local host, Linux pseudoterminal files, POSIX Message Queueue implementation in Linux, and Linux eventfd should be displayed with endpoint information and the files of the endpoints should also be displayed. Note 1: UNIX socket file endpoint information is only available when the compile flags line of -v output contains HASUXSOCKEPT, and psudoterminal endpoint informa‐ tion is only available when the compile flags line contains HASPTYEPT. Note 2: POSIX Message Queue file endpoint information is only available when mqueue file system is mounted. Pipe endpoint information is displayed in the NAME column in the form ``PID,cmd,FD‐ mode'', where PID is the endpoint process ID; cmd is the endpoint process command; FD is the endpoint file's descriptor; and mode is the endpoint file's access mode. Pseudoterminal endpoint information is displayed in the NAME column as ``->/dev/ptsmin PID,cmd,FDmode'' or ``PID,cmd,FDmode''. The first form is for a master device; the second, for a slave device. min is a slave device's minor device number; and PID, cmd, FD and mode are the same as with pipe endpoint information. Note: psudoterminal endpoint information is only available when the compile flags line of -V output contains HASPTYEPT. In addition, this feature works on Linux ker‐ nels above 4.13.0. UNIX socket file endpoint information is displayed in the NAME column in the form ``type=TYPE ->INO=INODE PID,cmd,FDmode'', where TYPE is the socket type; INODE is the i-node number of the connected socket; and PID, cmd, FD and mode are the same as with pipe endpoint information. Note: UNIX socket file endpoint information is available only when the compile flags line of -v output contains HASUXSOCKEPT. INET socket file endpoint information is inserted to the value at the NAME column in th form PID, cmd, FD and mode are the same as with pipe endpoint information. The endpoint information is available only if the socket is used for local IPC; both endpoints bind to the same local IPv4 or IPv6 address. POSIX Message Queue file endpoint information is displayed in the NAME column in the same form as that of pipe. eventfd endpoint information is displayed in the NAME column in the same form as that of pipe. This feature works on Linux kernels above 5.2.0. Multiple occurrences of this information can appear in a file's NAME column. -E specifies that endpoint supported files should be displayed with endpoint infor‐ mation, but not the files of the endpoints."
        },
        {
            "flag": "-F",
            "long": null,
            "arg": null,
            "description": "by another program, and the character that terminates each output field. Each field to be output is specified with a single character in f. The field terminator de‐ faults to NL, but may be changed to NUL (000). See the OUTPUT FOR OTHER PROGRAMS section for a description of the field identification characters and the field out‐ put process. When the field selection character list is empty, all standard fields are selected (except the raw device field, security context and zone field for compatibility rea‐ sons) and the NL field terminator is used. When the field selection character list contains only a zero (`0'), all fields are selected (except the raw device field for compatibility reasons) and the NUL termi‐ nator character is used. Other combinations of fields and their associated field terminator character must be set with explicit entries in f, as described in the OUTPUT FOR OTHER PROGRAMS sec‐ tion. When a field selection character identifies an item lsof does not normally list - e.g., PPID, selected with -R - specification of the field character - e.g., ``-FR'' - also selects the listing of the item. When the field selection character list contains the single character `?', lsof will display a help list of the field identification characters. (Escape the `?' charac‐ ter as your shell requires.)"
        },
        {
            "flag": "-g",
            "long": null,
            "arg": null,
            "description": "group IDentification (PGID) numbers are in the comma-separated set s - e.g., ``123'' or ``123,^456''. (There should be no spaces in the set.) PGID numbers that begin with `^' (negation) represent exclusions. Multiple PGID numbers are joined in a single ORed set before participating in AND option selection. However, PGID exclusions are applied without ORing or ANDing and take effect before other selection criteria are applied. The -g option also enables the output display of PGID numbers. When specified with‐ out a PGID set that's all it does."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "ified in i. If no address is specified, this option selects the listing of all In‐ ternet 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 op‐ tional.): [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 di‐ alect supports IPv6, run lsof and specify the -h or -? (help) option. If the dis‐ played description of the -i option contains ``[46]'' and ``IPv[46]'', IPv6 is sup‐ ported. IPv4 host names and addresses may not be specified if network file selection is lim‐ ited to IPv6 with -i 6. IPv6 host names and addresses may not be specified if net‐ work 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, hostname, hostaddr, or service - must be supplied. The `@' character, leading the host specification, is always re‐ quired; 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"
        },
        {
            "flag": "-K",
            "long": null,
            "arg": null,
            "description": "reporting is supported. (If help output - i.e., the output of the -h or -? options - shows this option, then task (thread) reporting is supported by the dialect.) If -K is followed by a value, k, it must be ``i''. That causes lsof to ignore tasks, particularly in the default, list-everything case when no other options are specified. When -K and -a are both specified on Linux, and the tasks of a main process are se‐ lected by other options, the main process will also be listed as though it were a task, but without a task ID. (See the description of the TID column in the OUTPUT section.) Where the FreeBSD version supports threads, all threads will be listed with their IDs. In general threads and tasks inherit the files of the caller, but may close some and open others, so lsof always reports all the open files of threads and tasks."
        },
        {
            "flag": "-k",
            "long": null,
            "arg": null,
            "description": "available under AIX on the IBM RISC/System 6000."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "login name lookup is working improperly or slowly. +|-L [l] enables (`+') or disables (`-') the listing of file link counts, where they are available - e.g., they aren't available for sockets, or most FIFOs and pipes. When +L is specified without a following number, all link counts will be listed. When -L is specified (the default), no link counts will be listed. When +L is followed by a number, only files having a link count less than that num‐ ber will be listed. (No number may follow -L.) A specification of the form ``+L1'' will select open files that have been unlinked. A specification of the form ``+aL1 <filesystem>'' will select unlinked open files on the specified file system. For other link count comparisons, use field output (-F) and a post-processing script or program. +|-m m specifies an alternate kernel memory file or activates mount table supplement pro‐ cessing. The option form -m m specifies a kernel memory file, m, in place of /dev/kmem or /dev/mem - e.g., a crash dump file. The option form +m requests that a mount supplement file be written to the standard output file. All other options are silently ignored. There will be a line in the mount supplement file for each mounted file system, con‐ taining the mounted file system directory, followed by a single space, followed by the device number in hexadecimal \"0x\" format - e.g., / 0x801 Lsof can use the mount supplement file to get device numbers for file systems when it can't get them via stat(2) or lstat(2). The option form +m m identifies m as a mount supplement file. Note: the +m and +m m options are not available for all supported dialects. Check the output of lsof's -h or -? options to see if the +m and +m m options are avail‐ able. +|-M Enables (+) or disables (-) the reporting of portmapper registrations for local TCP, UDP and UDPLITE ports, where port mapping is supported. (See the last paragraph of this option description for information about where portmapper registration report‐ ing is supported.) The default reporting mode is set by the lsof builder with the HASPMAPENABLED #de‐ fine in the dialect's machine.h header file; lsof is distributed with the HASPMAPEN‐ ABLED #define deactivated, so portmapper reporting is disabled by default and must be requested with +M. Specifying lsof's -h or -? option will report the default mode. Disabling portmapper registration when it is already disabled or enabling it when already enabled is acceptable. When portmapper registration reporting is en‐ abled, lsof displays the portmapper registration (if any) for local TCP, UDP or UD‐ PLITE ports in square brackets immediately following the port numbers or service names - e.g., ``:1234[name]'' or ``:name[100083]''. The registration information may be a name or number, depending on what the registering program supplied to the portmapper when it registered the port. When portmapper registration reporting is enabled, lsof may run a little more slowly or even become blocked when access to the portmapper becomes congested or stopped. Reverse the reporting mode to determine if portmapper registration reporting is slowing or blocking lsof. For purposes of portmapper registration reporting lsof considers a TCP, UDP or UD‐ PLITE port local if: it is found in the local part of its containing kernel struc‐ ture; or if it is located in the foreign part of its containing kernel structure and the local and foreign Internet addresses are the same; or if it is located in the foreign part of its containing kernel structure and the foreign Internet address is INADDRLOOPBACK (127.0.0.1). This rule may make lsof ignore some foreign ports on machines with multiple interfaces when the foreign Internet address is on a differ‐ ent interface from the local one. See the lsof FAQ (The FAQ section gives its location.) for further discussion of portmapper registration reporting issues. Portmapper registration reporting is supported only on dialects that have RPC header files. (Some Linux distributions with GlibC 2.14 do not have them.) When portmap‐ per registration reporting is supported, the -h or -? help output will show the +|-M option."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": "hibiting conversion may make lsof run faster. It is also useful when host name lookup is not working properly."
        },
        {
            "flag": "-N",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": "column title to be changed to OFFSET. Note: on some UNIX dialects lsof can't obtain accurate or consistent file offset information from its kernel data sources, some‐ times just for particular kinds of files (e.g., socket files.) Consult the lsof FAQ (The FAQ section gives its location.) for more information. The -o and -s options are mutually exclusive; they can't both be specified. When neither is specified, lsof displays whatever value - size or offset - is appropriate and available for the type of the file."
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": "offset before the form is switched to ``0x...''. An o value of zero (unlimited) di‐ rects lsof to use the ``0t'' form for all offset output. This option does NOT direct lsof to display offset at all times; specify -o (without a trailing number) to do that. -o o only specifies the number of digits after ``0t'' in either mixed size and offset or offset-only output. Thus, for example, to direct lsof to display offset at all times with a decimal digit count of 10, use: -o -o 10 or -oo10 The default number of digits allowed after ``0t'' is normally 8, but may have been changed by the lsof builder. Consult the description of the -o o option in the out‐ put of the -h or -? option to determine the default that is in effect."
        },
        {
            "flag": "-O",
            "long": null,
            "arg": null,
            "description": "operations - i.e., doing them in forked child processes. See the BLOCKS AND TIME‐ OUTS and AVOIDING KERNEL BLOCKS sections for more information on kernel operations that may block lsof. While use of this option will reduce lsof startup overhead, it may also cause lsof to hang when the kernel doesn't respond to a function. Use this option cautiously."
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": "IDentification (PID) numbers are in the comma-separated set s - e.g., ``123'' or ``123,^456''. (There should be no spaces in the set.) PID numbers that begin with `^' (negation) represent exclusions. Multiple process ID numbers are joined in a single ORed set before participating in AND option selection. However, PID exclusions are applied without ORing or ANDing and take effect before other selection criteria are applied."
        },
        {
            "flag": "-P",
            "long": null,
            "arg": null,
            "description": "the conversion may make lsof run a little faster. It is also useful when port name lookup is not working properly."
        },
        {
            "flag": "-Q",
            "long": null,
            "arg": null,
            "description": "users of a device, or for a specific PID, or for certain protocols in use by that PID, and so on, lsof will return an error if any of the search results are empty. The -Q option will change this behavior so that lsof will instead return a success‐ ful exit code (0) even if any of the search results are empty. In addition, missing search terms will not be reported to stderr. +|-r [t[c<N>][m<fmt>]] puts lsof in repeat mode. There lsof lists open files as selected by other options, delays t seconds (default fifteen), then repeats the listing, delaying and listing repetitively until stopped by a condition defined by the prefix to the option. If the prefix is a `-', repeat mode is endless. Lsof must be terminated with an in‐ terrupt or quit signal. `c<N>' is for specifying the limits of repeating; if the number of iterations reaches at `<N>', Lsof stops itself. If the prefix is `+', repeat mode will end the first cycle no open files are listed - and of course when lsof is stopped with an interrupt or quit signal. When repeat mode ends because no files are listed, the process exit code will be zero if any open files were ever listed; one, if none were ever listed. Lsof marks the end of each listing: if field output is in progress (the -F, option has been specified), the default marker is `m'; otherwise the default marker is ``========''. The marker is followed by a NL character. The optional \"m<fmt>\" argument specifies a format for the marker line. The <fmt> characters following `m' are interpreted as a format specification to the strf‐ time(3) function, when both it and the localtime(3) function are available in the dialect's C library. Consult the strftime(3) documentation for what may appear in its format specification. Note that when field output is requested with the -F op‐ tion, <fmt> cannot contain the NL format, ``%n''. Note also that when <fmt> con‐ tains spaces or other characters that affect the shell's interpretation of argu‐ ments, <fmt> must be quoted appropriately. Repeat mode reduces lsof startup overhead, so it is more efficient to use this mode than to call lsof repetitively from a shell script, for example. To use repeat mode most efficiently, accompany +|-r with specification of other lsof selection options, so the amount of kernel memory access lsof does will be kept to a minimum. Options that filter at the process level - e.g., -c, -g, -p, -u - are the most efficient selectors. Repeat mode is useful when coupled with field output (see the -F, option descrip‐ tion) and a supervising awk or Perl script, or a C program."
        },
        {
            "flag": "-R",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "put column title to be changed to SIZE. If the file does not have a size, nothing is displayed. The optional -s p:s form is available only for selected dialects, and only when the -h or -? help output lists it. When the optional form is available, the s may be followed by a protocol name (p), either TCP or UDP, a colon (`:') and a comma-separated protocol state name list, the option causes open TCP and UDP files to be excluded if their state name(s) are in the list (s) preceded by a `^'; or included if their name(s) are not preceded by a `^'. Dialects that support this option may support only one protocol. When an unsup‐ ported protocol is specified, a message will be displayed indicating state names for the protocol are unavailable. When an inclusion list is defined, only network files with state names in the list will be present in the lsof output. Thus, specifying one state name means that only network files with that lone state name will be listed. Case is unimportant in the protocol or state names, but there may be no spaces and the colon (`:') separating the protocol name (p) and the state name list (s) is re‐ quired. If only TCP and UDP files are to be listed, as controlled by the specified exclu‐ sions and inclusions, the -i option must be specified, too. If only a single proto‐ col's files are to be listed, add its name as an argument to the -i option. For example, to list only network files with TCP state LISTEN, use: -iTCP -sTCP:LISTEN Or, for example, to list network files with all UDP states except Idle, use: -iUDP -sUDP:^Idle State names vary with UNIX dialects, so it's not possible to provide a complete list. Some common TCP state names are: CLOSED, IDLE, BOUND, LISTEN, ESTABLISHED, SYNSENT, SYNRCDV, ESTABLISHED, CLOSEWAIT, FINWAIT1, CLOSING, LASTACK, FINWAIT2, and TIMEWAIT. Two common UDP state names are Unbound and Idle. See the lsof FAQ (The FAQ section gives its location.) for more information on how to use protocol state exclusion and inclusion, including examples. The -o (without a following decimal digit count) and -s option (without a following protocol and state name list) are mutually exclusive; they can't both be specified. When neither is specified, lsof displays whatever value - size or offset - is appro‐ priate and available for the type of file. Since some types of files don't have true sizes - sockets, FIFOs, pipes, etc. - lsof displays for their sizes the content amounts in their associated kernel buffers, if possible."
        },
        {
            "flag": "-S",
            "long": null,
            "arg": null,
            "description": "link(2), and stat(2) - that might otherwise deadlock. The minimum for t is two; the default, fifteen; when no value is specified, the default is used. See the BLOCKS AND TIMEOUTS section for more information."
        },
        {
            "flag": "-T",
            "long": null,
            "arg": null,
            "description": "following the network addresses. In normal output the information appears in paren‐ theses, each item except TCP or TPI state name identified by a keyword, followed by `=', separated from others by a single space: <TCP or TPI state name> QR=<read queue length> QS=<send queue length> SO=<socket options and values> SS=<socket states> TF=<TCP flags and values> WR=<window read length> WW=<window write length> Not all values are reported for all UNIX dialects. Items values (when available) are reported after the item name and '='. When the field output mode is in effect (See OUTPUT FOR OTHER PROGRAMS.) each item appears as a field with a `T' leading character. -T with no following key characters disables TCP/TPI information reporting. -T with following characters selects the reporting of specific TCP/TPI information: f selects reporting of socket options, states and values, and TCP flags and values. q selects queue length reporting. s selects connection state reporting. w selects window size reporting. Not all selections are enabled for some UNIX dialects. State may be selected for all dialects and is reported by default. The -h or -? help output for the -T op‐ tion will show what selections may be used with the UNIX dialect. When -T is used to select information - i.e., it is followed by one or more selec‐ tion characters - the displaying of state is disabled by default, and it must be ex‐ plicitly selected again in the characters following -T. (In effect, then, the de‐ fault is equivalent to -Ts.) For example, if queue lengths and state are desired, use -Tqs. Socket options, socket states, some socket values, TCP flags and one TCP value may be reported (when available in the UNIX dialect) in the form of the names that com‐ monly appear after SO, so, SS, TCP and TF in the dialect's header files - most often <sys/socket.h>, <sys/socketvar.h> and <netinet/tcpvar.h>. Consult those header files for the meaning of the flags, options, states and values. ``SO='' precedes socket options and values; ``SS='', socket states; and ``TF='', TCP flags and values. If a flag or option has a value, the value will follow an '=' and the name -- e.g., ``SO=LINGER=5'', ``SO=QLIM=5'', ``TF=MSS=512''. The following seven values may be reported: Name Reported Description (Common Symbol) KEEPALIVE keep alive time (SOKEEPALIVE) LINGER linger time (SOLINGER) MSS maximum segment size (TCPMAXSEG) PQLEN partial listen queue connections QLEN established listen queue connections QLIM established listen queue limit RCVBUF receive buffer length (SORCVBUF) SNDBUF send buffer length (SOSNDBUF) Details on what socket options and values, socket states, and TCP flags and values may be displayed for particular UNIX dialects may be found in the answer to the ``Why doesn't lsof report socket options, socket states, and TCP flags and values for my dialect?'' and ``Why doesn't lsof report the partial listen queue connection count for my dialect?'' questions in the lsof FAQ (The FAQ section gives its loca‐ tion.) On Linux this option also prints the state of UNIX domain sockets."
        },
        {
            "flag": "-t",
            "long": null,
            "arg": null,
            "description": "it is easy to use programmatically. e.g. # reload anything using old SSL lsof -t /lib/*/libssl.so.* | xargs -r kill -HUP # get list of processes and then iterate over them (Bash only) mapfile -t pids < <( lsof -wt /var/log/your.log ) for pid in \"${pids[@]}\" ; do yourcommand -p \"$pid\" done The -t option implies the -w option."
        },
        {
            "flag": "-u",
            "long": null,
            "arg": null,
            "description": "in the comma-separated set s - e.g., ``abe'', or ``548,root''. (There should be no spaces in the set.) Multiple login names or user ID numbers are joined in a single ORed set before par‐ ticipating in AND option selection. If a login name or user ID is preceded by a `^', it becomes a negation - i.e., files of processes owned by the login name or user ID will never be listed. A negated lo‐ gin name or user ID selection is neither ANDed nor ORed with other selections; it is applied before all other selections and absolutely excludes the listing of the files of the process. For example, to direct lsof to exclude the listing of files belong‐ ing to root processes, specify ``-u^root'' or ``-u^0''."
        },
        {
            "flag": "-U",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "the lsof binary was constructed; who constructed the binary and where; the name of the compiler used to construct the lsof binary; the version number of the compiler when readily available; the compiler and loader flags used to construct the lsof bi‐ nary; and system information, typically the output of uname's -a option."
        },
        {
            "flag": "-V",
            "long": null,
            "arg": null,
            "description": "names, file names, Internet addresses or files, login names, NFS files, PIDs, PGIDs, and UIDs. When other options are ANDed to search options, or compile-time options restrict the listing of some files, lsof may not report that it failed to find a search item when an ANDed option or compile-time option prevents the listing of the open file con‐ taining the located search item. For example, ``lsof -V -iTCP@foobar -a -d 999'' may not report a failure to locate open files at ``TCP@foobar'' and may not list any, if none have a file descriptor number of 999. A similar situation arises when HASSECURITY and HASNOSOCKSECURITY are defined at compile time and they prevent the listing of open files. +|-w Enables (+) or disables (-) the suppression of warning messages. The lsof builder may choose to have warning messages disabled or enabled by default. The default warning message state is indicated in the output of the -h or -? op‐ tion. Disabling warning messages when they are already disabled or enabling them when already enabled is acceptable. The -t option implies the -w option."
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "bolic links and|or file system mount points encountered when scanning the directory (+d) or directory tree (+D). If -x is specified by itself without a following parameter, cross-over processing of both symbolic links and file system mount points is enabled. Note that when -x is specified without a parameter, the next argument must begin with '-' or '+'. The optional 'f' parameter enables file system mount point cross-over processing; 'l', symbolic link cross-over processing. The -x option may not be supplied without also supplying a +d or +D option."
        },
        {
            "flag": "-X",
            "long": null,
            "arg": null,
            "description": "AIX: This IBM AIX RISC/System 6000 option requests the reporting of executed text file and shared library references. WARNING: because this option uses the kernel readx() function, its use on a busy AIX system might cause an application process to hang so completely that it can neither be killed nor stopped. I have never seen this happen or had a report of its happen‐ ing, but I think there is a remote possibility it could happen. By default use of readx() is disabled. On AIX 5L and above lsof may need se‐ tuid-root permission to perform the actions this option requests. The lsof builder may specify that the -X option be restricted to processes whose real UID is root. If that has been done, the -X option will not appear in the -h or -? help output unless the real UID of the lsof process is root. The default lsof distribution allows any UID to specify -X, so by default it will appear in the help output. When AIX readx() use is disabled, lsof may not be able to report information for all text and loader file references, but it may also avoid exacerbating an AIX kernel directory search kernel error, known as the Stale Segment ID bug. The readx() function, used by lsof or any other program to access some sections of kernel virtual memory, can trigger the Stale Segment ID bug. It can cause the ker‐ nel's dirsearch() function to believe erroneously that part of an in-memory copy of a file system directory has been zeroed. Another application process, distinct from lsof, asking the kernel to search the directory - e.g., by using open(2) - can cause dirsearch() to loop forever, thus hanging the application process. Consult the lsof FAQ (The FAQ section gives its location.) and the 00README file of the lsof distribution for a more complete description of the Stale Segment ID bug, its APAR, and methods for defining readx() use when compiling lsof. Linux: This Linux option requests that lsof skip the reporting of information on all open TCP, UDP and UDPLITE IPv4 and IPv6 files. This Linux option is most useful when the system has an extremely large number of open TCP, UDP and UDPLITE files, the processing of whose information in the /proc/net/tcp* and /proc/net/udp* files would take lsof a long time, and whose re‐ porting is not of interest. Use this option with care and only when you are sure that the information you want lsof to display isn't associated with open TCP, UDP or UDPLITE socket files. Solaris 10 and above: This Solaris 10 and above option requests the reporting of cached paths for files that have been deleted - i.e., removed with rm(1) or unlink(2). The cached path is followed by the string `` (deleted)'' to indicate that the path by which the file was opened has been deleted. Because intervening changes made to the path - i.e., renames with mv(1) or rename(2) - are not recorded in the cached path, what lsof reports is only the path by which the file was opened, not its possibly different final path."
        },
        {
            "flag": "-z",
            "long": null,
            "arg": null,
            "description": "Without a following argument - e.g., NO z - the option specifies that zone names are to be listed in the ZONE output column. The -z option may be followed by a zone name, z. That causes lsof to list only open files for processes in that zone. Multiple -z z option and argument pairs may be specified to form a list of named zones. Any open file of any process in any of the zones will be listed, subject to other conditions specified by other options and ar‐ guments."
        },
        {
            "flag": "-Z",
            "long": null,
            "arg": null,
            "description": "character support are inhibited when SELinux is disabled in the running Linux ker‐ nel. See OUTPUT FOR OTHER PROGRAMS for more information on the 'Z' field output character. Without a following argument - e.g., NO Z - the option specifies that security con‐ texts are to be listed in the SECURITY-CONTEXT output column. The -Z option may be followed by a wildcard security context name, Z. That causes lsof to list only open files for processes in that security context. Multiple -Z Z option and argument pairs may be specified to form a list of security contexts. Any open file of any process in any of the security contexts will be listed, subject to other conditions specified by other options and arguments. Note that Z can be A:B:C or *:B:C or A:B:* or *:*:C to match against the A:B:C context. -- The double minus sign option is a marker that signals the end of the keyed options. It may be used, for example, when the first file name begins with a minus sign. It may also be used when the absence of a value for the last keyed option must be sig‐ nified by the presence of a minus sign in the following option and before the start of the file names. 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 ``--'' op‐ tion. 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 re‐ stricted to processes that have it open as a file or as a process-specific direc‐ tory, 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 char‐ acters 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 op‐ tion selection."
        }
    ],
    "examples": [
        "For a more extensive set of examples, documented more fully, see the 00QUICKSTART file of the",
        "lsof distribution.",
        "To list all open files, use:",
        "lsof",
        "To list all open Internet, x.25 (HP-UX), and UNIX domain files, use:",
        "lsof -i -U",
        "To list all open IPv4 network files in use by the process whose PID is 1234, use:",
        "lsof -i 4 -a -p 1234",
        "If it's okay for PID 1234 to not exist, or for PID 1234 to not have  any  open  IPv4  network",
        "files, add -Q :",
        "lsof -Q -i 4 -a -p 1234",
        "Presuming the UNIX dialect supports IPv6, to list only open IPv6 network files, use:",
        "lsof -i 6",
        "To  list  all  files  using any protocol on ports 513, 514, or 515 of host wonderland.cc.pur‐",
        "due.edu, use:",
        "lsof -i @wonderland.cc.purdue.edu:513-515",
        "To list all files using any protocol on any port of mace.cc.purdue.edu (cc.purdue.edu is  the",
        "default domain), use:",
        "lsof -i @mace",
        "To  list  all  open files for login name ``abe'', or user ID 1234, or process 456, or process",
        "123, or process 789, use:",
        "lsof -p 456,123,789 -u 1234,abe",
        "To list all open files on device /dev/hd4, use:",
        "lsof /dev/hd4",
        "To find the process that has /u/abe/foo open without worrying if there are none, use:",
        "lsof -Q /u/abe/foo",
        "To take action only if a process has /u/abe/foo open, use:",
        "lsof /u/abe/foo  echo \"still in use\"",
        "To send a SIGHUP to the processes that have /u/abe/bar open, use:",
        "kill -HUP `lsof -t /u/abe/bar`",
        "To find any open file, including an open UNIX domain socket file,  with  the  name  /dev/log,",
        "use:",
        "lsof /dev/log",
        "To  find processes with open files on the NFS file system named /nfs/mount/point whose server",
        "is  inaccessible,  and  presuming  your  mount  table  supplies   the   device   number   for",
        "/nfs/mount/point, use:",
        "lsof -b /nfs/mount/point",
        "To do the preceding search with warning messages suppressed, use:",
        "lsof -bw /nfs/mount/point",
        "To ignore the device cache file, use:",
        "lsof -Di",
        "To  obtain  PID  and command name field output for each process, file descriptor, file device",
        "number, and file inode number for each file of each process, use:",
        "lsof -FpcfDi",
        "To list the files at descriptors 1 and 3 of every process running the lsof command for  login",
        "ID ``abe'' every 10 seconds, use:",
        "lsof -c lsof -a -d 1 -d 3 -u abe -r10",
        "To  list  the  current  working directory of processes running a command that is exactly four",
        "characters long and has an 'o' or 'O' in character three, use this regular expression form of",
        "the -c c option:",
        "lsof -c /^..o.$/i -a -d cwd",
        "To find an IP version 4 socket file by its associated numeric dot-form address, use:",
        "lsof -i@128.210.15.17",
        "To find an IP version 6 socket file (when the UNIX dialect supports IPv6) by  its  associated",
        "numeric colon-form address, use:",
        "lsof -i@[0:1:2:3:4:5:6:7]",
        "To  find  an  IP version 6 socket file (when the UNIX dialect supports IPv6) by an associated",
        "numeric colon-form address that has a run of zeroes in it - e.g.,  the  loop-back  address  -",
        "use:",
        "lsof -i@[::1]",
        "To obtain a repeat mode marker line that contains the current time, use:",
        "lsof -rm====%T====",
        "To add spaces to the previous marker line, use:",
        "lsof -r \"m==== %T ====\""
    ],
    "see_also": [
        {
            "name": "access",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/access/2/json"
        },
        {
            "name": "awk",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/awk/1/json"
        },
        {
            "name": "crash",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/crash/1/json"
        },
        {
            "name": "fattach",
            "section": "3C",
            "url": "https://www.chedong.com/phpMan.php/man/fattach/3C/json"
        },
        {
            "name": "ff",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ff/1/json"
        },
        {
            "name": "fstat",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fstat/8/json"
        },
        {
            "name": "fuser",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/fuser/1/json"
        },
        {
            "name": "gethostname",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/gethostname/2/json"
        },
        {
            "name": "print",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/print/3/json"
        },
        {
            "name": "kill",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/kill/1/json"
        },
        {
            "name": "localtime",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/localtime/3/json"
        },
        {
            "name": "lstat",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/lstat/2/json"
        },
        {
            "name": "modload",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/modload/8/json"
        },
        {
            "name": "mount",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mount/8/json"
        },
        {
            "name": "netstat",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/netstat/1/json"
        },
        {
            "name": "ofiles",
            "section": "8L",
            "url": "https://www.chedong.com/phpMan.php/man/ofiles/8L/json"
        },
        {
            "name": "open",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/open/2/json"
        },
        {
            "name": "perl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/perl/1/json"
        },
        {
            "name": "ps",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ps/1/json"
        },
        {
            "name": "readlink",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/readlink/2/json"
        },
        {
            "name": "setlocale",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/setlocale/3/json"
        },
        {
            "name": "stat",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/stat/2/json"
        },
        {
            "name": "strftime",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/strftime/3/json"
        },
        {
            "name": "time",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/time/2/json"
        },
        {
            "name": "uname",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/uname/1/json"
        }
    ]
}