Bump to lsof 4.91
[platform/upstream/lsof.git] / lsof.8
1 .ds VN 4.91
2 .TH LSOF 8 Revision-\*(VN
3 \" Register )P is used neither by this file nor any groff macro.  However,
4 \" some versions of nroff require it.
5 .if !\n(.g \{\
6 .   if !\n()P .nr )P 1v
7 .\}
8 .SH NAME
9 lsof \- list open files
10 .SH SYNOPSIS
11 .B lsof
12 [
13 .B \-?abChlnNOPRtUvVX
14 ] [
15 .BI -A " A"
16 ] [
17 .BI \-c " c"
18 ] [
19 .BI +c " c"
20 ] [
21 .BI +|\-d " d"
22 ] [
23 .BI +|\-D " D"
24 ] [
25 .BI +|\-e " s"
26 ] [
27 .B +|-E
28 ] [
29 .B +|\-f [cfgGn]
30 ] [
31 .BI \-F " [f]"
32 ] [
33 .BI \-g " [s]"
34 ] [
35 .BI \-i " [i]"
36 ] [
37 .BI \-k " k"
38 ] [
39 .BI \-K " k"
40 ] [
41 .BI +|\-L " [l]"
42 ] [
43 .BI +|\-m " m"
44 ] [
45 .B +|\-M
46 ] [
47 .BI \-o " [o]"
48 ] [
49 .BI \-p " s"
50 ] [
51 .BI +|\-r " [t[m<fmt>]]"
52 ] [
53 .BI \-s " [p:s]"
54 ] [
55 .BI \-S " [t]"
56 ] [
57 .BI \-T " [t]"
58 ] [
59 .BI \-u " s"
60 ] [
61 .B +|\-w
62 ] [
63 .BI \-x " [fl]"
64 ] [
65 .BI \-z " [z]"
66 ] [
67 .BI \-Z " [Z]"
68 ] [
69 .B --
70 ] [\fInames\fP]
71 .SH DESCRIPTION
72 .I Lsof
73 revision \*(VN lists on its standard output file information about files
74 opened by processes for the following UNIX dialects:
75 .PP
76 .nf
77         Apple Darwin 9 and Mac OS X 10.[567]
78         FreeBSD 8.[234], 9.0 and 1[012].0 for AMD64-based systems
79         Linux 2.1.72 and above for x86-based systems
80         Solaris 9, 10 and 11
81 .fi
82 .PP
83 (See the
84 .B DISTRIBUTION
85 section of this manual page for information on how to obtain the
86 latest
87 .I lsof
88 revision.)
89 .PP
90 An open file may be a regular file, a directory, a block special file,
91 a character special file, an executing text reference, a library,
92 a stream or a network file (Internet socket, NFS file or UNIX domain socket.)
93 A specific file or all the files in a file system may be selected by path.
94 .PP
95 Instead of a formatted display,
96 .I lsof
97 will produce output that can be parsed by other programs.
98 See the
99 .BR \-F ,
100 option description, and the
101 .B "OUTPUT FOR OTHER PROGRAMS"
102 section for more information.
103 .PP
104 In addition to producing a single output list,
105 .I lsof
106 will run in repeat mode.
107 In repeat mode it will produce output, delay, then repeat the output
108 operation until stopped with an interrupt or quit signal.
109 See the
110 .BI +|\-r " [t[m<fmt>]]"
111 option description for more information.
112 .SH OPTIONS
113 In the absence of any options,
114 .I lsof
115 lists all open files belonging to all active processes.
116 .PP
117 If any list request option is specified, other list requests must be
118 specifically requested \- e.g., if
119 .B \-U
120 is specified for the listing of UNIX socket files, NFS files won't be
121 listed unless
122 .B \-N
123 is also specified;
124 or if a user list is specified with the
125 .B \-u
126 option, UNIX domain socket files, belonging to users not in the list,
127 won't be listed unless the
128 .B \-U
129 option is also specified.
130 .PP
131 Normally list options that are specifically stated are ORed \- i.e.,
132 specifying the
133 .B \-i
134 option without an address and the \fB\-u\fPfoo option produces a
135 listing of all network files OR files belonging to processes owned
136 by user ``foo''.
137 The exceptions are:
138 .TP \w'1)\ 'u
139 1)
140 the `^' (negated) login name or user ID (UID), specified with the
141 .B \-u
142 option;
143 .TP \w'1)\ 'u
144 2)
145 the `^' (negated) process ID (PID), specified with the
146 .B \-p
147 option;
148 .TP \w'1)\ 'u
149 3)
150 the `^' (negated) process group ID (PGID), specified with the
151 .B \-g
152 option;
153 .TP \w'1)\ 'u
154 4)
155 the `^' (negated) command, specified with the
156 .B \-c
157 option;
158 .TP \w'1)\ 'u
159 5)
160 the (`^') negated TCP or UDP protocol state names, specified with the
161 .BI \-s " [p:s]"
162 option.
163 .PP
164 Since they represent exclusions, they are applied without ORing or ANDing
165 and take effect before any other selection criteria are applied.
166 .PP
167 The
168 .B \-a
169 option may be used to AND the selections.
170 For example, specifying
171 .BR \-a ,
172 .BR \-U ,
173 and \fB\-u\fPfoo produces a listing of only UNIX socket files that
174 belong to processes owned by user ``foo''.
175 .PP
176 Caution: the
177 .B \-a
178 option causes all list selection options to be ANDed; it can't
179 be used to cause ANDing of selected pairs of selection options
180 by placing it between them, even though its placement there is
181 acceptable.
182 Wherever
183 .B \-a
184 is placed, it causes the ANDing of all selection options.
185 .PP
186 Items of the same selection set \- command names, file descriptors,
187 network addresses, process identifiers, user identifiers, zone names,
188 security contexts \- are joined in a single ORed set and applied
189 before the result participates in ANDing.
190 Thus, for example, specifying \fB\-i\fP@aaa.bbb, \fB\-i\fP@ccc.ddd,
191 .BR \-a ,
192 and \fB\-u\fPfff,ggg will select the listing of files that belong to
193 either login ``fff'' OR ``ggg'' AND have network connections to either
194 host aaa.bbb OR ccc.ddd.
195 .PP
196 Options may be grouped together following a single prefix -- e.g.,
197 the option set ``\fB\-a \-b \-C\fP'' may be stated as
198 .BR \-abC .
199 However, since values are optional following
200 .BR +|\-f ,
201 .BR \-F ,
202 .BR \-g ,
203 .BR \-i ,
204 .BR +|\-L ,
205 .BR \-o ,
206 .BR +|\-r ,
207 .BR \-s ,
208 .BR \-S ,
209 .BR \-T ,
210 .B \-x
211 and
212 .BR \-z .
213 when you have no values for them be careful that the
214 following character isn't ambiguous.
215 For example,
216 .B \-Fn
217 might represent the
218 .B \-F
219 and
220 .B \-n
221 options, or it might represent the
222 .B n
223 field identifier character following the
224 .B \-F
225 option.
226 When ambiguity is possible, start a new option with a `-'
227 character \- e.g., ``\fB\-F \-n\fP''.
228 If the next option is a file name, follow the possibly ambiguous
229 option with ``--'' \- e.g., ``\fB\-F -- \fIname\fR''.
230 .PP
231 Either the `+' or the `\-' prefix may be applied to a group of options.
232 Options that don't take on separate meanings for each
233 prefix \- e.g., \fB\-i\fP \- may be grouped under either prefix.
234 Thus, for example, ``+M -i'' may be stated as ``+Mi'' and the group
235 means the same as the separate options.
236 Be careful of prefix grouping when one or more options in the group
237 does take on separate meanings under different prefixes \-
238 e.g., \fB+|\-M\fP; ``-iM'' is not the same request as ``\-i +M''.
239 When in doubt, use separate options with appropriate prefixes.
240 .TP \w'names'u+4
241 .B \-? \-h
242 These two equivalent options select a usage (help) output list.
243 .I Lsof
244 displays a shortened form of this output when it detects an error
245 in the options supplied to it, after it has displayed messages
246 explaining each error.
247 (Escape the `?' character as your shell requires.)
248 .TP \w'names'u+4
249 .B \-a
250 causes list selection options to be ANDed, as described above.
251 .TP \w'names'u+4
252 .BI \-A " A"
253 is available on systems configured for AFS whose AFS
254 kernel code is implemented via dynamic modules.
255 It allows the
256 .I lsof
257 user to specify
258 .I A
259 as an alternate name list file where the kernel addresses of the dynamic
260 modules might be found.
261 See the
262 .I lsof
263 FAQ (The \fBFAQ\fP section gives its location.)
264 for more information about dynamic modules, their
265 symbols, and how they affect
266 .IR lsof .
267 .TP \w'names'u+4
268 .B \-b
269 causes
270 .I lsof
271 to avoid kernel functions that might block \-
272 .IR lstat (2),
273 .IR readlink (2),
274 and
275 .IR stat (2).
276 .IP
277 See the
278 .B "BLOCKS AND TIMEOUTS"
279 and
280 .B "AVOIDING KERNEL BLOCKS"
281 sections for information on using this option.
282 .TP \w'names'u+4
283 .BI \-c " c"
284 selects the listing of files for processes executing the
285 command that begins with the characters of
286 .IR c .
287 Multiple commands may be specified, using multiple
288 .B \-c
289 options.
290 They are joined in a single ORed set before participating in
291 AND option selection.
292 .IP
293 If
294 .I c
295 begins with a `^', then the following characters specify a command
296 name whose processes are to be ignored (excluded.)
297 .IP
298 If
299 .I c
300 begins and ends with a slash ('/'), the characters between the slashes
301 are interpreted as a regular expression.
302 Shell meta\-characters in the regular expression must be quoted to prevent
303 their interpretation by the shell.
304 The closing slash may be followed by these modifiers:
305 .IP
306 .nf
307         b       the regular expression is a basic one.
308 .br
309         i       ignore the case of letters.
310 .br
311         x       the regular expression is an extended one
312 .br
313                 (default).
314 .fi
315 .IP
316 See the
317 .I lsof
318 FAQ (The \fBFAQ\fP section gives its location.)
319 for more information on basic and extended regular
320 expressions.
321 .IP
322 The simple command specification is tested first.
323 If that test fails, the command regular expression is applied.
324 If the simple command test succeeds, the command regular expression
325 test isn't made.
326 This may result in ``no command found for regex:'' messages
327 when lsof's
328 .B \-V
329 option is specified.
330 .TP \w'names'u+4
331 .BI +c " w"
332 defines the maximum number of initial characters of the name,
333 supplied by the UNIX dialect, of the UNIX command associated with a process
334 to be printed in the COMMAND column.
335 (The
336 .I lsof
337 default is nine.)
338 .IP
339 Note that many UNIX dialects do not supply all command name characters
340 to
341 .I lsof
342 in the files and structures from which
343 .I lsof
344 obtains command name.
345 Often dialects limit the number of characters supplied in those sources.
346 For example, Linux 2.4.27 and Solaris 9 both limit command name length to
347 16 characters.
348 .IP
349 If
350 .I w
351 is zero ('0'), all command characters supplied to
352 .I lsof
353 by the UNIX dialect will be printed.
354 .IP
355 If
356 .I w
357 is less than the length of the column title, ``COMMAND'', it will
358 be raised to that length.
359 .TP \w'names'u+4
360 .B \-C
361 disables the reporting of any path name
362 components from the kernel's name cache.
363 See the
364 .B "KERNEL NAME CACHE"
365 section for more information.
366 .TP \w'names'u+4
367 .BI +d " s"
368 causes
369 .I lsof
370 to search for all open instances of directory
371 .I s
372 and the files and directories it contains at its top level.
373 .B +d
374 does NOT descend the directory tree, rooted at
375 .IR s .
376 The
377 .BI +D " D"
378 option may be used to request a full\-descent directory tree search,
379 rooted at directory
380 .IR D .
381 .IP
382 Processing of the
383 .B +d
384 option does not follow symbolic links within
385 .I s
386 unless the
387 .B \-x
388 or
389 .B \-x " l"
390 option is also specified.
391 Nor does it
392 search for open files on file system mount points on subdirectories of
393 .I s
394 unless the
395 .B \-x
396 or
397 .B \-x " f"
398 option is also specified.
399 .IP
400 Note: the authority of the user of this option limits it to searching for
401 files that the user has permission to examine with the system
402 .IR stat (2)
403 function.
404 .TP \w'names'u+4
405 .BI \-d " s"
406 specifies a list of file descriptors (FDs) to exclude from
407 or include in the output listing.
408 The file descriptors are specified in the comma\-separated set
409 .I s
410 \&\- e.g., ``cwd,1,3'', ``^6,^2''.
411 (There should be no spaces in the set.)
412 .IP
413 The list is an exclusion list if all entries of the set begin with `^'.
414 It is an inclusion list if no entry begins with `^'.
415 Mixed lists are not permitted.
416 .IP
417 A file descriptor number range may be in the set as long as
418 neither member is empty, both members are numbers, and the ending
419 member is larger than the starting one \- e.g., ``0-7'' or ``3-10''.
420 Ranges may be specified for exclusion if they have the `^' prefix \-
421 e.g., ``^0-7'' excludes all file descriptors 0 through 7.
422 .IP
423 Multiple file descriptor numbers are joined in a single ORed set before
424 participating in AND option selection.
425 .IP
426 When there are exclusion and inclusion members in the set,
427 .I lsof
428 reports them as errors and exits with a non\-zero return code.
429 .IP
430 See the description of File Descriptor (FD) output values in the
431 .B OUTPUT
432 section for more information on file descriptor names.
433 .TP \w'names'u+4
434 .BI +D " D"
435 causes
436 .I lsof
437 to search for all open instances of directory
438 .I D
439 and all the files and directories it contains to its complete depth.
440 .IP
441 Processing of the
442 .B +D
443 option does not follow symbolic links within
444 .I D
445 unless the
446 .B \-x
447 or
448 .B \-x " l"
449 option is also specified.
450 Nor does it
451 search for open files on file system mount points on subdirectories of
452 .I D
453 unless the
454 .B \-x
455 or
456 .B \-x " f"
457 option is also specified.
458 .IP
459 Note: the authority of the user of this option limits it to searching for
460 files that the user has permission to examine with the system
461 .IR stat (2)
462 function.
463 .IP
464 Further note:
465 .I lsof
466 may process this option slowly and require a large amount of dynamic memory
467 to do it.
468 This is because it must descend the entire directory tree, rooted at
469 .IR D ,
470 calling
471 .IR stat (2)
472 for each file and directory, building a list of all the files it finds, and
473 searching that list for a match with every open file.
474 When directory
475 .I D
476 is large, these steps can take a long time, so use this option prudently.
477 .TP \w'names'u+4
478 .BI \-D " D"
479 directs
480 .I lsof's
481 use of the device cache file.
482 The use of this option is sometimes restricted.
483 See the
484 .B "DEVICE CACHE FILE"
485 section and the sections that follow it for more information on this
486 option.
487 .IP
488 .B -D
489 must be followed by a function letter; the function letter may optionally
490 be followed by a path name.
491 .I Lsof
492 recognizes these function letters:
493 .IP
494 .nf
495         \fB?\fP \- report device cache file paths
496         \fBb\fP \- build the device cache file
497         \fBi\fP \- ignore the device cache file
498         \fBr\fP \- read the device cache file
499         \fBu\fP \- read and update the device cache file
500 .fi
501 .IP
502 The
503 .BR b ,
504 .BR r ,
505 and
506 .B u
507 functions, accompanied by a path name, are sometimes restricted.
508 When these functions are restricted, they will not appear in
509 the description of the
510 .B \-D
511 option that accompanies
512 .B \-h
513 or
514 .B \-?
515 option output.
516 See the
517 .B "DEVICE CACHE FILE"
518 section and the sections that follow it for more information on these
519 functions and when they're restricted.
520 .IP
521 The
522 .B ?
523 function reports the read\-only and write paths that lsof can
524 use for the device cache file,
525 the names of any environment variables whose values
526 .I lsof
527 will examine when forming the device cache file path,
528 and the format for the personal device cache file path.
529 (Escape the `?' character as your shell requires.)
530 .IP
531 When available, the
532 .BR b ,
533 .BR r ,
534 and
535 .B u
536 functions may be followed by the device cache file's path.
537 The standard default is
538 .I .lsof_hostname
539 in the home directory of the real user ID that executes
540 .IR lsof ,
541 but this could have been changed when
542 .I lsof
543 was configured and compiled.
544 (The output of the
545 .B \-h
546 and
547 .B \-?
548 options show the current default prefix \- e.g., ``.lsof''.)
549 The suffix,
550 .IR hostname ,
551 is the first component of the host's name returned by
552 .IR gethostname (2).
553 .IP
554 When available, the
555 .B b
556 function directs
557 .I lsof
558 to build a new device cache file at the default or specified path.
559 .IP
560 The
561 .B i
562 function directs
563 .I lsof
564 to ignore the default device cache file and obtain its information
565 about devices via direct calls to the kernel.
566 .IP
567 The
568 .B r
569 function directs
570 .I lsof
571 to read the device cache at the default or specified path, but
572 prevents it from creating a new device cache file when none
573 exists or the existing one is improperly structured.
574 The
575 .B r
576 function, when specified without a path name, prevents
577 .I lsof
578 from updating an incorrect or outdated device cache file,
579 or creating a new one in its place.
580 The
581 .B r
582 function is always available when it is specified without a
583 path name argument; it may be restricted by the permissions of the
584 .I lsof
585 process.
586 .IP
587 When available, the
588 .B u
589 function directs
590 .I lsof
591 to read the device cache file at the default or specified path,
592 if possible, and to rebuild it, if necessary.
593 This is the default device cache file function when no
594 .B \-D
595 option has been specified.
596 .TP \w'names'u+4
597 .BI +|\-e " s"
598 exempts the file system whose path name is
599 .I s
600 from being subjected to kernel function calls that might block.
601 The
602 .B +e
603 option exempts
604 .IR stat (2),
605 .IR lstat (2)
606 and most
607 .IR readlink (2)
608 kernel function calls.
609 The
610 .B \-e
611 option exempts only
612 .IR stat(2)
613 and
614 .IR lstat (2)
615 kernel function calls.
616 Multiple file systems may be specified with separate
617 .B +|\-e
618 specifications and each may have
619 .IR readlink (2)
620 calls exempted or not.
621 .IP
622 This option is currently implemented only for Linux.
623 .IP
624 .B CAUTION:
625 this option can easily be mis\-applied to other than
626 the file system of interest, because it uses path name rather
627 than the more reliable device and inode numbers.
628 (Device and inode numbers are acquired via the potentially blocking
629 .IR stat (2)
630 kernel call and are thus not available, but see the
631 .BI +|\-m " m"
632 option as a possible alternative way to supply device numbers.)
633 \fBUse this option with great care and fully specify the path name of the
634 file system to be exempted.\fP
635 .IP
636 When open files on exempted file systems are reported, it may not be
637 possible to obtain all their information.
638 Therefore, some information columns will be blank, the characters ``UNKN''
639 preface the values in the TYPE column, and the applicable exemption option
640 is added in parentheses to the end of the NAME column.
641 (Some device number information might be made available via the
642 .BI +|\-m " m"
643 option.)
644 .TP \w'names'u+4
645 .B +|-E
646 .B +E
647 specifies that Linux pipe, Linux UNIX socket and Linux pseudoterminal files
648 should be displayed with endpoint information and the files of the endpoints should also be displayed.
649 Note: UNIX socket file endpoint information is only available when the
650 compile flags line of
651 .B \-v
652 output contains HASUXSOCKEPT, and psudoterminal endpoint information is only
653 available when the compile flags line contains HASPTYEPT.
654 .IP
655 Pipe endpoint information is displayed in the NAME column in the
656 form ``\fIPID,cmd,FDmode\fP'', where
657 .I PID
658 is the endpoint process ID;
659 .I cmd
660 is the endpoint process command;
661 .I FD
662 is the endpoint file's descriptor; and
663 .I mode
664 is the endpoint file's access mode.
665 .IP
666 Pseudoterminal
667 endpoint information is displayed in the NAME column as
668 ``->/dev/pts\fImin\fP\ \fIPID,cmd,FDmode\fP'' or ``\fIPID,cmd,FDmode\fP''.
669 The first form is for a master device; the second, for a slave device.
670 .I min
671 is a slave device's minor device number; and
672 .I "PID, cmd, FD"
673 and
674 .I mode
675 are the same as with pipe endpoint information.
676 Note: psudoterminal endpoint information is only available when the compile
677 flags line of
678 .B \-V
679 output contains HASPTYEPT.
680 .IP
681 UNIX socket file endpoint information is displayed in the NAME column
682 in the form
683 .br
684 ``type=\fITYPE\fP\ ->INO=\fIINODE\fP\ \fIPID,cmd,FDmode\fP'', where
685 .I TYPE
686 is the socket type;
687 .I INODE
688 is the i-node number of the connected socket;
689 and
690 .I "PID, cmd, FD"
691 and
692 .I mode
693 are the same as with pipe endpoint information.
694 Note: UNIX socket file endpoint information is available only when the
695 compile flags line of
696 .B \-v
697 output contains HASUXSOCKEPT.
698 .IP
699 Multiple occurrences of this information can appear in a file's
700 NAME column.
701 .IP
702 .B -E
703 specfies that Linux pipe and Linux UNIX socket files should be displayed
704 with endpoint information, but not the files of the endpoints.
705 .TP \w'names'u+4
706 .B +|\-f [cfgGn]
707 .B f
708 by itself clarifies how path name arguments are to be interpreted.
709 When followed by
710 .BR c ,
711 .BR f ,
712 .BR g ,
713 .BR G ,
714 or
715 .B n
716 in any combination it specifies
717 that the listing of kernel file structure information is to be enabled
718 (`+') or inhibited (`\-').
719 .IP
720 Normally a path name argument is taken to be a file system name if
721 it matches a mounted\-on directory name reported by
722 .IR mount (8),
723 or if it represents a block device, named in the
724 .I mount
725 output and associated with a mounted directory name.
726 When
727 .B +f
728 is specified, all path name arguments will be taken to be file
729 system names, and
730 .I lsof
731 will complain if any are not.
732 This can be useful, for example, when the file system name
733 (mounted\-on device) isn't a block device.
734 This happens for some CD-ROM file systems.
735 .IP
736 When
737 .B \-f
738 is specified by itself, all path name arguments will be taken to be
739 simple files.
740 Thus, for example, the ``\fB\-f\fP\ -- /'' arguments direct lsof to search
741 for open files with a `/' path name, not all open files in the `/'
742 (root) file system.
743 .IP
744 Be careful to make sure
745 .B +f
746 and
747 .B \-f
748 are properly terminated and aren't followed by a character (e.g., of
749 the file or file system name) that might be taken as a parameter.
750 For example, use ``--'' after
751 .B +f
752 and
753 .B \-f
754 as in these examples.
755 .IP
756 .nf
757         $ lsof +f -- /file/system/name
758         $ lsof -f -- /file/name
759 .fi
760 .IP
761 The listing of information from kernel file structures, requested with the
762 .B +f [cfgGn]
763 option form, is normally
764 inhibited, and is not available in whole or part for some dialects \- e.g.,
765 /proc\-based Linux kernels below 2.6.22.
766 When the prefix to
767 .B f
768 is a plus sign (`+'), these characters request file structure information:
769 .IP
770 .nf
771         \fBc\fR file structure use count (not Linux)
772         \fBf\fR file structure address (not Linux)
773         \fBg\fR file flag abbreviations (Linux 2.6.22 and up)
774         \fBG\fR file flags in hexadecimal (Linux 2.6.22 and up)
775         \fBn\fR file structure node address (not Linux)
776 .fi
777 .IP
778 When the prefix is minus (`\-') the same characters disable the
779 listing of the indicated values.
780 .IP
781 File structure addresses, use counts, flags, and node addresses may be
782 used to detect more readily identical files inherited by child
783 processes and identical files in use by different processes.
784 .I Lsof
785 column output can be sorted by output columns holding the values
786 and listed to identify identical file use, or
787 .I lsof
788 field output can be parsed by an AWK or Perl post\-filter script,
789 or by a C program.
790 .TP \w'names'u+4
791 .BI \-F " f"
792 specifies a character list,
793 .IR f ,
794 that selects the fields to be output for processing by another program,
795 and the character that terminates each output field.
796 Each field to be output is specified with a single character in
797 .IR f .
798 The field terminator defaults to NL, but may be changed to NUL (000).
799 See the
800 .B "OUTPUT FOR OTHER PROGRAMS"
801 section for a description of the field identification characters and
802 the field output process.
803 .IP
804 When the field selection character list is empty, all standard fields are
805 selected (except the raw device field, security context and zone field for
806 compatibility reasons)
807 and the NL field terminator is used.
808 .IP
809 When the field selection character list contains only a zero (`0'),
810 all fields are selected (except the raw device field for compatibility
811 reasons) and the NUL terminator character is used.
812 .IP
813 Other combinations of fields and their associated field terminator
814 character must be set with explicit entries in
815 .IR f ,
816 as described in the
817 .B "OUTPUT FOR OTHER PROGRAMS"
818 section.
819 .IP
820 When a field selection character identifies an item
821 .I lsof
822 does not normally list \- e.g., PPID, selected with
823 .BR \-R " \-"
824 specification of the field character \- e.g., ``\fB\-FR\fP'' \-
825 also selects the listing of the item.
826 .IP
827 When the field selection character list contains the single
828 character `?',
829 .I lsof
830 will display a help list of the field identification characters.
831 (Escape the `?' character as your shell requires.)
832 .TP \w'names'u+4
833 .BI \-g " [s]"
834 excludes or selects the listing of files for the processes
835 whose optional process group IDentification (PGID) numbers are in the
836 comma\-separated set
837 .I s
838 \&\- e.g., ``123'' or ``123,^456''.
839 (There should be no spaces in the set.)
840 .IP
841 PGID numbers that begin with `^' (negation) represent exclusions.
842 .IP
843 Multiple PGID numbers are joined in a single ORed set before participating
844 in AND option selection.
845 However, PGID exclusions are applied without ORing or ANDing
846 and take effect before other selection criteria are applied.
847 .IP
848 The
849 .B \-g
850 option also enables the output display of PGID numbers.
851 When specified without a PGID set that's all it does.
852 .TP \w'names'u+4
853 .BI \-i " [i]"
854 selects the listing of files any of whose Internet address
855 matches the address specified in \fIi\fP.
856 If no address is specified, this option selects the listing of all
857 Internet and x.25 (HP\-UX) network files.
858 .IP
859 If
860 .BI \-i 4
861 or
862 .BI \-i 6
863 is specified with no following address, only files of the indicated
864 IP version, IPv4 or IPv6, are displayed.
865 (An IPv6 specification may be used only if the dialects supports IPv6,
866 as indicated by ``[46]'' and ``IPv[46]'' in
867 .I lsof's
868 .B \-h
869 or
870 .B \-?
871 output.)
872 Sequentially specifying
873 .BR \-i 4,
874 followed by
875 .BR \-i 6
876 is the same as specifying
877 .BR \-i ,
878 and vice-versa.
879 Specifying
880 .BR \-i 4,
881 or
882 .BR \-i 6
883 after
884 .B \-i
885 is the same as specifying
886 .BR \-i 4
887 or
888 .BR \-i 6
889 by itself.
890 .IP
891 Multiple addresses (up to a limit of 100) may be specified with multiple
892 .B \-i
893 options.
894 (A port number or service name range is counted as one address.)
895 They are joined in a single ORed set before participating in
896 AND option selection.
897 .IP
898 An Internet address is specified in the form (Items in square
899 brackets are optional.):
900 .IP
901 .ie !\n(.g \{
902 [\fI46\fP][\fIprotocol\fP][@\fIhostname\fP\||\|\fIhostaddr\fP][:\fIservice\fP\||\|\fIport\fP]
903 \}
904 .el \{
905 .RI [ 46 ][ protocol ][@ hostname \||\| hostaddr ][: service \||\| port ]
906 \}
907 .IP
908 where:
909 .nf
910 .br
911         \fI46\fP specifies the IP version, IPv4 or IPv6
912 .br
913                 that applies to the following address.
914 .br
915                 '6' may be be specified only if the UNIX
916 .br
917                 dialect supports IPv6.  If neither '4' nor
918 .br
919                 '6' is specified, the following address
920 .br
921                 applies to all IP versions.
922 .br
923         \fIprotocol\fP is a protocol name \- \fBTCP\fP, \fBUDP\fP
924 .br             or \fBUDPLITE\fP.
925 .br
926         \fIhostname\fP is an Internet host name.  Unless a
927 .br
928                 specific IP version is specified, open
929 .br
930                 network files associated with host names
931 .br
932                 of all versions will be selected.
933 .br
934         \fIhostaddr\fP is a numeric Internet IPv4 address in
935 .br
936                 dot form; or an IPv6 numeric address in
937 .br
938                 colon form, enclosed in brackets, if the
939 .br
940                 UNIX dialect supports IPv6.  When an IP
941 .br
942                 version is selected, only its numeric
943 .br
944                 addresses may be specified.
945 .br
946         \fIservice\fP is an \fI/etc/services\fP name \- e.g., \fBsmtp\fP \-
947                 or a list of them.
948 .br
949         \fIport\fP is a port number, or a list of them.
950 .fi
951 .IP
952 IPv6 options may be used only if the UNIX dialect supports IPv6.
953 To see if the dialect supports IPv6, run
954 .I lsof
955 and specify the
956 .B \-h
957 or
958 .B \-?
959 (help) option.
960 If the displayed description of the
961 .B \-i
962 option contains ``[46]'' and ``IPv[46]'', IPv6 is supported.
963 .IP
964 IPv4 host names and addresses may not be specified if network file selection
965 is limited to IPv6 with
966 .BR \-i " 6."
967 IPv6 host names and addresses may not be specified if network file selection
968 is limited to IPv4 with
969 .BR \-i " 4."
970 When an open IPv4 network file's address is mapped in an IPv6 address,
971 the open file's type will be IPv6, not IPv4, and its display will be
972 selected by '6', not '4'.
973 .IP
974 At least one address component \-
975 .BR 4,
976 .BR 6,
977 .IR protocol ,
978 .IR hostname ,
979 .IR hostaddr ,
980 or
981 .I service
982 \&\- must be supplied.
983 The `@' character, leading the host specification, is always required;
984 as is the `:', leading the port specification.
985 Specify either
986 .I hostname
987 or
988 .IR hostaddr .
989 Specify either
990 .I service
991 name list or
992 .I port
993 number list.
994 If a
995 .I service
996 name list is specified, the
997 .I protocol
998 may also need to be specified if the TCP, UDP and UDPLITE port numbers for
999 the service name are different.
1000 Use any case \- lower or upper \- for
1001 .IR protocol .
1002 .IP
1003 .I Service
1004 names and
1005 .I port
1006 numbers may be combined in a list whose entries are separated by commas
1007 and whose numeric range entries are separated by minus signs.
1008 There may be no embedded spaces, and all service names must belong to
1009 the specified
1010 .IR protocol .
1011 Since service names may contain embedded minus signs, the starting entry
1012 of a range can't be a service name; it can be a port number, however.
1013 .IP
1014 Here are some sample addresses:
1015 .nf
1016
1017 .br
1018         -i6 \- IPv6 only
1019 .br
1020         TCP:25 \- TCP and port 25
1021 .br
1022         @1.2.3.4 \- Internet IPv4 host address 1.2.3.4
1023 .br
1024         @[3ffe:1ebc::1]:1234 \- Internet IPv6 host address
1025                 3ffe:1ebc::1, port 1234
1026 .br
1027         UDP:who \- UDP who service port
1028 .br
1029         TCP@lsof.itap:513 \- TCP, port 513 and host name lsof.itap
1030 .br
1031         tcp@foo:1-10,smtp,99 \- TCP, ports 1 through 10,
1032                 service name \fIsmtp\fP, port 99, host name foo
1033 .br
1034         tcp@bar:1-smtp \- TCP, ports 1 through \fIsmtp\fP, host bar
1035 .br
1036         :time \- either TCP, UDP or UDPLITE time service port
1037 .fi
1038 .TP \w'names'u+4
1039 .BI \-K " k"
1040 selects the listing of tasks (threads) of processes, on dialects
1041 where task (thread) reporting is supported.
1042 (If help output \- i.e., the output of the
1043 .B \-h
1044 or
1045 .B \-?
1046 options \- shows this option, then task (thread) reporting is
1047 supported by the dialect.)
1048 .IP
1049 If
1050 .B \-K
1051 is followed by a value,
1052 .IR k ,
1053 it must be ``i''.  That causes
1054 .I lsof
1055 to ignore tasks, particularly in the default, list\-everything case
1056 when no other options are specified.
1057 .IP
1058 When
1059 .B \-K
1060 and
1061 .B \-a
1062 are both specified on Linux, and the tasks of a main process are
1063 selected by other options, the main process will also be listed
1064 as though it were a task, but without a task ID.
1065 (See the description of the TID column in the
1066 .B OUTPUT
1067 section.)
1068 .IP
1069 Where the FreeBSD version supports threads, all threads will be
1070 listed with their IDs.
1071 .IP
1072 In general threads and tasks inherit the files of the caller, but
1073 may close some and open others, so
1074 .I lsof
1075 always reports all the open files of threads and tasks.
1076 .TP \w'names'u+4
1077 .BI \-k " k"
1078 specifies a kernel name list file,
1079 .IR k ,
1080 in place of /vmunix, /mach, etc.
1081 .B \-k
1082 is not available under AIX on the IBM RISC/System 6000.
1083 .TP \w'names'u+4
1084 .B \-l
1085 inhibits the conversion of user ID numbers to login names.
1086 It is also useful when login name lookup is working improperly or slowly.
1087 .TP \w'names'u+4
1088 .BI +|\-L " [l]"
1089 enables (`+') or disables (`-') the listing of file link
1090 counts, where they are available \- e.g., they aren't available
1091 for sockets, or most FIFOs and pipes.
1092 .IP
1093 When
1094 .B +L
1095 is specified without a following number, all link counts will be listed.
1096 When
1097 .B \-L
1098 is specified (the default), no link counts will be listed.
1099 .IP
1100 When
1101 .B +L
1102 is followed by a number, only files having a link count less than
1103 that number will be listed.
1104 (No number may follow
1105 .BR \-L .)
1106 A specification of the form ``\fB+L1\fP'' will select open files that
1107 have been unlinked.
1108 A specification of the form ``\fB+aL1\ \fI<file_system>\fR'' will select
1109 unlinked open files on the specified file system.
1110 .IP
1111 For other link count comparisons, use field output (\fB\-F\fP)
1112 and a post\-processing script or program.
1113 .TP \w'names'u+4
1114 .BI +|\-m " m"
1115 specifies an alternate kernel memory file or activates
1116 mount table supplement processing.
1117 .IP
1118 The option form
1119 .BI \-m " m"
1120 specifies a kernel memory file,
1121 .IR m ,
1122 in place of
1123 .I /dev/kmem
1124 or
1125 .I /dev/mem
1126 \&\- e.g., a crash dump file.
1127 .IP
1128 The option form
1129 .B +m
1130 requests that a mount supplement file be written to the standard output
1131 file.
1132 All other options are silently ignored.
1133 .IP
1134 There will be a line in the mount supplement file for each mounted file
1135 system, containing the mounted file system directory, followed by a single
1136 space, followed by the device number in hexadecimal "0x" format \- e.g.,
1137 .IP
1138 .nf
1139         / 0x801
1140 .fi
1141 .IP
1142 .I Lsof
1143 can use the mount supplement file to get device numbers for file systems
1144 when it can't get them via
1145 .IR stat (2)
1146 or
1147 .IR lstat (2).
1148 .IP
1149 The option form
1150 .BI +m " m"
1151 identifies
1152 .I m
1153 as a mount supplement file.
1154 .IP
1155 Note: the
1156 .B +m
1157 and
1158 .BI +m " m"
1159 options are not available for all supported dialects.
1160 Check the output of
1161 .I lsof's
1162 .B \-h
1163 or
1164 .B \-?
1165 options to see if the
1166 .B +m
1167 and
1168 .BI +m " m"
1169 options are available.
1170 .TP \w'names'u+4
1171 .B +|\-M
1172 Enables (\fB+\fP) or disables (\fB\-\fP) the
1173 reporting of portmapper registrations for local TCP, UDP and UDPLITE ports,
1174 where port mapping is supported.
1175 (See the last paragraph of this option description for information about
1176 where portmapper registration reporting is supported.)
1177 .IP
1178 The default reporting mode is set by the
1179 .I lsof
1180 builder with the HASPMAPENABLED #define in the dialect's machine.h
1181 header file;
1182 .I lsof
1183 is distributed with the HASPMAPENABLED #define deactivated, so
1184 portmapper reporting is disabled by default and must be requested
1185 with
1186 .BR +M .
1187 Specifying
1188 .I lsof's
1189 .B \-h
1190 or
1191 .B \-?
1192 option will report the default mode.
1193 Disabling portmapper registration when it is already disabled or
1194 enabling it when already enabled is acceptable.
1195 When portmapper registration reporting is enabled,
1196 .I lsof
1197 displays the portmapper registration (if any) for local TCP, UDP or
1198 UDPLITE ports
1199 in square brackets immediately following the port numbers or service
1200 names \- e.g., ``:1234[name]'' or ``:name[100083]''.
1201 The registration information may be a name or number, depending
1202 on what the registering program supplied to the portmapper when
1203 it registered the port.
1204 .IP
1205 When portmapper registration reporting is enabled,
1206 .I lsof
1207 may run a little more slowly or even become blocked when access to the
1208 portmapper becomes congested or stopped.
1209 Reverse the reporting mode to determine if portmapper registration
1210 reporting is slowing or blocking
1211 .IR lsof .
1212 .IP
1213 For purposes of portmapper registration reporting
1214 .I lsof
1215 considers a TCP, UDP or UDPLITE port local if: it is found in the local part
1216 of its containing kernel structure;
1217 or if it is located in the foreign part of its containing kernel
1218 structure and the local and foreign Internet addresses are the same;
1219 or if it is located in the foreign part of its containing kernel
1220 structure and the foreign Internet address is INADDR_LOOPBACK (127.0.0.1).
1221 This rule may make
1222 .I lsof
1223 ignore some foreign ports on machines with multiple interfaces
1224 when the foreign Internet address is on a different interface
1225 from the local one.
1226 .IP
1227 See the
1228 .I lsof
1229 FAQ (The \fBFAQ\fP section gives its location.)
1230 for further discussion of portmapper registration
1231 reporting issues.
1232 .IP
1233 Portmapper registration reporting is supported only on dialects that
1234 have RPC header files.
1235 (Some Linux distributions with GlibC 2.14 do not have them.)
1236 When portmapper registration reporting is supported, the
1237 .B \-h
1238 or
1239 .B \-?
1240 help output will show the
1241 .B +|\-M
1242 option.
1243 .TP \w'names'u+4
1244 .B \-n
1245 inhibits the conversion of network numbers to
1246 host names for network files.
1247 Inhibiting conversion may make
1248 .I lsof
1249 run faster.
1250 It is also useful when host name lookup is not working properly.
1251 .TP \w'names'u+4
1252 .B \-N
1253 selects the listing of NFS files.
1254 .TP \w'names'u+4
1255 .BI \-o
1256 directs
1257 .I lsof
1258 to display file offset at all times.
1259 It causes the SIZE/OFF output column title to be changed to OFFSET.
1260 Note: on some UNIX dialects
1261 .I lsof
1262 can't obtain accurate or consistent file offset information from its
1263 kernel data sources, sometimes just for particular kinds of files
1264 (e.g., socket files.)
1265 Consult the
1266 .I lsof
1267 FAQ (The \fBFAQ\fP section gives its location.)
1268 for more information.
1269 .IP
1270 The
1271 .B \-o
1272 and
1273 .B \-s
1274 options are mutually exclusive; they can't both be specified.
1275 When neither is specified,
1276 .I lsof
1277 displays whatever value \- size or offset \- is appropriate and
1278 available for the type of the file.
1279 .TP \w'names'u+4
1280 .BI \-o " o"
1281 defines the number of decimal digits (\fIo\fP) to be
1282 printed after the ``0t'' for a file offset before the form is switched
1283 to ``0x...''.
1284 An
1285 .I o
1286 value of zero (unlimited) directs
1287 .I lsof
1288 to use the ``0t'' form for all offset output.
1289 .IP
1290 This option does NOT direct
1291 .I lsof
1292 to display offset at all times; specify
1293 .B \-o
1294 (without a trailing number) to do that.
1295 .BI \-o " o"
1296 only specifies the number of digits after ``0t'' in
1297 either mixed size and offset or offset\-only output.
1298 Thus, for example, to direct
1299 .I lsof
1300 to display offset at all times with a decimal digit count of 10, use:
1301 .IP
1302 .nf
1303         -o -o 10
1304 or
1305         -oo10
1306 .fi
1307 .IP
1308 The default number of digits allowed after ``0t'' is normally 8,
1309 but may have been changed by the lsof builder.
1310 Consult the description of the
1311 .BI \-o " o"
1312 option in the output of the
1313 .B \-h
1314 or
1315 .B \-?
1316 option to determine the default that is in effect.
1317 .TP \w'names'u+4
1318 .B \-O
1319 directs
1320 .I lsof
1321 to bypass the strategy it uses to avoid being blocked by some
1322 kernel operations \- i.e., doing them in forked child processes.
1323 See the
1324 .B "BLOCKS AND TIMEOUTS"
1325 and
1326 .B "AVOIDING KERNEL BLOCKS"
1327 sections for more information on kernel operations that may block
1328 .IR lsof .
1329 .IP
1330 While use of this option will reduce
1331 .I lsof
1332 startup overhead, it may also cause
1333 .I lsof
1334 to hang when the kernel doesn't respond to a function.
1335 Use this option cautiously.
1336 .TP \w'names'u+4
1337 .BI \-p " s"
1338 excludes or selects the listing of files for the processes
1339 whose optional process IDentification (PID) numbers are in the
1340 comma\-separated set
1341 .I s
1342 \&\- e.g., ``123'' or ``123,^456''.
1343 (There should be no spaces in the set.)
1344 .IP
1345 PID numbers that begin with `^' (negation) represent exclusions.
1346 .IP
1347 Multiple process ID numbers are joined in a single ORed set before
1348 participating in AND option selection.
1349 However, PID exclusions are applied without ORing or ANDing
1350 and take effect before other selection criteria are applied.
1351 .TP \w'names'u+4
1352 .B \-P
1353 inhibits the conversion of port numbers to port
1354 names for network files.
1355 Inhibiting the conversion may make
1356 .I lsof
1357 run a little faster.
1358 It is also useful when port name lookup is not working properly.
1359 .TP \w'names'u+4
1360 .BI +|\-r " [t[m<fmt>]]"
1361 puts
1362 .I lsof
1363 in repeat mode.
1364 There
1365 .I lsof
1366 lists open files as selected by other options, delays
1367 .I t
1368 seconds (default fifteen), then repeats the listing, delaying
1369 and listing repetitively until stopped by a condition defined by
1370 the prefix to the option.
1371 .IP
1372 If the prefix is a `\-', repeat mode is endless.
1373 .I Lsof
1374 must be terminated with an interrupt or quit signal.
1375 .IP
1376 If the prefix is `+', repeat mode will end the first cycle no open files
1377 are listed \- and of course when
1378 .I lsof
1379 is stopped with an interrupt or quit signal.
1380 When repeat mode ends because no files are listed, the process exit code
1381 will be zero if any open files were ever listed; one, if none were ever
1382 listed.
1383 .IP
1384 .I Lsof
1385 marks the end of each listing:
1386 if field output is in progress (the
1387 .BR \-F ,
1388 option has been specified), the default marker is `m'; otherwise the
1389 default marker is ``========''.
1390 The marker is followed by a NL character.
1391 .IP
1392 The optional "m<fmt>" argument specifies a format for the marker line.
1393 The <fmt> characters following `m' are interpreted as a format
1394 specification to the
1395 .IR strftime (3)
1396 function, when both it and the
1397 .IR localtime (3)
1398 function are available in the dialect's C library.
1399 Consult the
1400 .IR strftime (3)
1401 documentation for what may appear in its format specification.
1402 Note that when field output is requested with the
1403 .B \-F
1404 option, <fmt> cannot contain the NL format, ``%n''.
1405 Note also that when <fmt> contains spaces or other characters that
1406 affect the shell's interpretation of arguments, <fmt> must be
1407 quoted appropriately.
1408 .IP
1409 Repeat mode reduces
1410 .I lsof
1411 startup overhead, so it is more efficient to use this mode
1412 than to call
1413 .I lsof
1414 repetitively from a shell script, for example.
1415 .IP
1416 To use repeat mode most efficiently, accompany
1417 .B +|\-r
1418 with specification of other
1419 .I lsof
1420 selection options, so the amount of kernel memory access
1421 .I lsof
1422 does will be kept to a minimum.
1423 Options that filter at the process level \- e.g.,
1424 .BR \-c ,
1425 .BR \-g ,
1426 .BR \-p ,
1427 .B \-u
1428 \&\- are the most efficient selectors.
1429 .IP
1430 Repeat mode is useful when coupled with field output (see the
1431 .BR \-F ,
1432 option description) and a supervising
1433 .I awk
1434 or
1435 .I Perl
1436 script, or a C program.
1437 .TP \w'names'u+4
1438 .B \-R
1439 directs lsof to list the Parent Process IDentification
1440 number in the PPID column.
1441 .TP \w'names'u+4
1442 .BI \-s " [p:s]"
1443 .B s
1444 alone directs
1445 .I lsof
1446 to display file size at all times.
1447 It causes the SIZE/OFF output column title to be changed to SIZE.
1448 If the file does not have a size, nothing is displayed.
1449 .IP
1450 The optional
1451 .BI \-s " p:s"
1452 form is available only for selected dialects, and only when the
1453 .B \-h
1454 or
1455 .B \-?
1456 help output lists it.
1457 .IP
1458 When the optional form is available, the
1459 .B s
1460 may be followed by a protocol name (\fIp\fR), either TCP or UDP,
1461 a colon (`:') and a comma\-separated protocol state name list,
1462 the option causes open TCP and UDP files to be excluded if their
1463 state name(s) are in the list (\fIs\fP) preceded by a `^'; or
1464 included if their name(s) are not preceded by a `^'.
1465 .IP
1466 Dialects that support this option may support only one protocol.
1467 When an unsupported protocol is specified, a message will be
1468 displayed indicating state names for the protocol are unavailable.
1469 .IP
1470 When an inclusion list is defined, only network files with state
1471 names in the list will be present in the
1472 .I lsof
1473 output.
1474 Thus, specifying one state name means that only network files
1475 with that lone state name will be listed.
1476 .IP
1477 Case is unimportant in the protocol or state names, but there may
1478 be no spaces and the colon (`:') separating the protocol
1479 name (\fIp\fP) and the state name list (\fIs\fP) is required.
1480 .IP
1481 If only TCP and UDP files are to be listed, as controlled by
1482 the specified exclusions and inclusions, the
1483 .B \-i
1484 option must be specified, too.
1485 If only a single protocol's files are to be listed, add its name
1486 as an argument to the
1487 .B \-i
1488 option.
1489 .IP
1490 For example, to list only network files with TCP state LISTEN, use:
1491 .IP
1492 .nf
1493         \-iTCP \-sTCP:LISTEN
1494 .fi
1495 .IP
1496 Or, for example, to list network files with all UDP states except
1497 Idle, use:
1498 .IP
1499 .nf
1500         \-iUDP -sUDP:Idle
1501 .fi
1502 .IP
1503 State names vary with UNIX dialects, so it's not possible to
1504 provide a complete list.  Some common TCP state names are:
1505 CLOSED, IDLE, BOUND, LISTEN, ESTABLISHED, SYN_SENT, SYN_RCDV,
1506 ESTABLISHED, CLOSE_WAIT, FIN_WAIT1, CLOSING, LAST_ACK, FIN_WAIT_2,
1507 and TIME_WAIT.
1508 Two common UDP state names are Unbound and Idle.
1509 .IP
1510 See the
1511 .I lsof
1512 FAQ (The \fBFAQ\fP section gives its location.)
1513 for more information on how to use protocol state exclusion and
1514 inclusion, including examples.
1515 .IP
1516 The
1517 .B \-o
1518 (without a following decimal digit count) and
1519 .B \-s
1520 option (without a following protocol and state name list)
1521 are mutually exclusive; they can't both be specified.
1522 When neither is specified,
1523 .I lsof
1524 displays whatever value \- size or offset \- is appropriate and
1525 available for the type of file.
1526 .IP
1527 Since some types of files don't have true sizes \- sockets, FIFOs,
1528 pipes, etc.\& \- lsof displays for their sizes the content amounts in
1529 their associated kernel buffers, if possible.
1530 .TP \w'names'u+4
1531 .BI \-S " [t]"
1532 specifies an optional time-out seconds value for kernel functions \-
1533 .IR lstat (2),
1534 .IR readlink (2),
1535 and
1536 .IR stat (2)
1537 \- that might otherwise deadlock.
1538 The minimum for
1539 .I t
1540 is two;
1541 the default, fifteen; when no value is specified, the default is used.
1542 .IP
1543 See the
1544 .B "BLOCKS AND TIMEOUTS"
1545 section for more information.
1546 .TP \w'names'u+4
1547 .BI \-T " [t]"
1548 controls the reporting of some TCP/TPI information, also
1549 reported by
1550 .IR netstat (1),
1551 following the network addresses.
1552 In normal output the information appears in parentheses, each item
1553 except TCP or TPI state name identified by a keyword, followed by `=',
1554 separated from others by a single space:
1555 .IP
1556 .nf
1557         <TCP or TPI state name>
1558         QR=<read queue length>
1559         QS=<send queue length>
1560         SO=<socket options and values>
1561         SS=<socket states>
1562         TF=<TCP flags and values>
1563         WR=<window read length>
1564         WW=<window write length>
1565 .fi
1566 .IP
1567 Not all values are reported for all UNIX dialects.
1568 Items values (when available) are reported after the item name and '='.
1569 .IP
1570 When the field output mode is in effect (See
1571 .BR "OUTPUT FOR OTHER PROGRAMS" .)
1572 each item appears as a field with a `T' leading character.
1573 .IP
1574 .B \-T
1575 with no following key characters disables TCP/TPI information reporting.
1576 .IP
1577 .B \-T
1578 with following characters selects the reporting of specific TCP/TPI
1579 information:
1580 .IP
1581 .nf
1582         \fBf\fP selects reporting of socket options,
1583                 states and values, and TCP flags and
1584                 values.
1585         \fBq\fP selects queue length reporting.
1586         \fBs\fP selects connection state reporting.
1587         \fBw\fP selects window size reporting.
1588 .fi
1589 .IP
1590 Not all selections are enabled for some UNIX dialects.
1591 State may be selected for all dialects and is reported by default.
1592 The
1593 .B \-h
1594 or
1595 .B \-?
1596 help output for the
1597 .B \-T
1598 option will show what selections may be used with the UNIX dialect.
1599 .IP
1600 When
1601 .B \-T
1602 is used to select information \- i.e., it is followed by one or more
1603 selection characters \- the displaying of state is disabled by default,
1604 and it must be explicitly selected again in the characters following
1605 .BR \-T .
1606 (In effect, then, the default is equivalent to
1607 .BR -Ts .)
1608 For example, if queue lengths and state are desired, use
1609 .BR \-Tqs .
1610 .IP
1611 Socket options, socket states, some socket values, TCP flags and
1612 one TCP value may be reported (when available in the UNIX dialect)
1613 in the form of the names that commonly appear after SO_, so_, SS_,
1614 TCP_  and TF_ in the dialect's header files \-
1615 most often <sys/socket.h>, <sys/socketvar.h> and <netinet/tcp_var.h>.
1616 Consult those header files for the meaning of the flags, options,
1617 states and values.
1618 .IP
1619 ``SO='' precedes socket options and values; ``SS='', socket states;
1620 and ``TF='', TCP flags and values.
1621 .IP
1622 If a flag or option has a value, the value will follow an '=' and
1623 the name -- e.g., ``SO=LINGER=5'', ``SO=QLIM=5'', ``TF=MSS=512''.
1624 The following seven values may be reported:
1625 .IP
1626 .nf
1627         Name
1628         Reported        Description (Common Symbol)
1629
1630         KEEPALIVE       keep alive time (SO_KEEPALIVE)
1631         LINGER  linger time (SO_LINGER)
1632         MSS             maximum segment size (TCP_MAXSEG)
1633         PQLEN           partial listen queue connections
1634         QLEN            established listen queue connections
1635         QLIM            established listen queue limit
1636         RCVBUF  receive buffer length (SO_RCVBUF)
1637         SNDBUF  send buffer length (SO_SNDBUF)
1638 .fi
1639 .IP
1640 Details on what socket options and values, socket states, and TCP flags
1641 and values may be displayed for particular UNIX dialects may be found in
1642 the answer to the ``Why doesn't lsof report socket options, socket states,
1643 and TCP flags and values for my dialect?'' and ``Why doesn't lsof report
1644 the partial listen queue connection count for my dialect?''
1645 questions in the
1646 .I lsof
1647 FAQ (The \fBFAQ\fP section gives its location.)
1648 .TP \w'names'u+4
1649 .B \-t
1650 specifies that
1651 .I lsof
1652 should produce terse output with process identifiers only and no header \-
1653 e.g., so that the output may be piped to
1654 .IR kill (1).
1655 .B \-t
1656 selects the
1657 .B \-w
1658 option.
1659 .TP \w'names'u+4
1660 .BI \-u " s"
1661 selects the listing of files for the user whose login names
1662 or user ID numbers are in the comma\-separated set
1663 .I s
1664 \&\- e.g., ``abe'',
1665 or ``548,root''.
1666 (There should be no spaces in the set.)
1667 .IP
1668 Multiple login names or user ID numbers are joined in a single ORed set
1669 before participating in AND option selection.
1670 .IP
1671 If a login name or user ID is preceded by a `^', it becomes a negation \-
1672 i.e., files of processes owned by the login name or user ID will never
1673 be listed.
1674 A negated login name or user ID selection is neither ANDed nor ORed
1675 with other selections; it is applied before all other selections and
1676 absolutely excludes the listing of the files of the process.
1677 For example, to direct
1678 .I lsof
1679 to exclude the listing of files belonging to root processes,
1680 specify ``\-u^root'' or ``\-u^0''.
1681 .TP \w'names'u+4
1682 .B \-U
1683 selects the listing of UNIX domain socket files.
1684 .TP \w'names'u+4
1685 .B \-v
1686 selects the listing of
1687 .I lsof
1688 version information, including: revision number;
1689 when the
1690 .I lsof
1691 binary was constructed;
1692 who constructed the binary and where;
1693 the name of the compiler used to construct the
1694 .I lsof binary;
1695 the version number of the compiler when readily available;
1696 the compiler and loader flags used to construct the
1697 .I lsof
1698 binary;
1699 and system information, typically the output of
1700 .IR uname 's
1701 .B \-a
1702 option.
1703 .TP \w'names'u+4
1704 .B \-V
1705 directs
1706 .I lsof
1707 to indicate the items it was asked to list and failed to find \- command
1708 names, file names, Internet addresses or files, login names, NFS files,
1709 PIDs, PGIDs, and UIDs.
1710 .IP
1711 When other options are ANDed to search options, or compile\-time
1712 options restrict the listing of some files,
1713 .I lsof
1714 may not report that it failed to find a search item when an ANDed
1715 option or compile\-time option prevents the listing of the open file
1716 containing the located search item.
1717 .IP
1718 For example, ``lsof -V -iTCP@foobar -a -d 999'' may not report a
1719 failure to locate open files at ``TCP@foobar'' and may not list
1720 any, if none have a file descriptor number of 999.
1721 A similar situation arises when HASSECURITY and HASNOSOCKSECURITY are
1722 defined at compile time and they prevent the listing of open files.
1723 .TP \w'names'u+4
1724 .B +|\-w
1725 Enables (\fB+\fP) or disables (\fB-\fP) the suppression of warning messages.
1726 .IP
1727 The
1728 .I lsof
1729 builder may choose to have warning messages disabled or enabled by
1730 default.
1731 The default warning message state is indicated in the output of the
1732 .B \-h
1733 or
1734 .B \-?
1735 option.
1736 Disabling warning messages when they are already disabled or enabling
1737 them when already enabled is acceptable.
1738 .IP
1739 The
1740 .B \-t
1741 option selects the
1742 .B \-w
1743 option.
1744 .TP \w'names'u+4
1745 .BI \-x " [fl]"
1746 may accompany the
1747 .B +d
1748 and
1749 .B +D
1750 options to direct their processing to cross over symbolic
1751 links and|or file system mount points encountered when
1752 scanning the directory (\fB+d\fP) or directory tree (\fB+D\fP).
1753 .IP
1754 If
1755 .B -x
1756 is specified by itself without a following parameter, cross\-over
1757 processing of both symbolic links and file system mount points is
1758 enabled.
1759 Note that when
1760 .B \-x
1761 is specified without a parameter, the next argument must begin with '-'
1762 or '+'.
1763 .IP
1764 The optional 'f' parameter enables file system mount point cross\-over
1765 processing; 'l', symbolic link cross\-over processing.
1766 .IP
1767 The
1768 .B \-x
1769 option may not be supplied without also supplying a
1770 .B +d
1771 or
1772 .B +D
1773 option.
1774 .TP \w'names'u+4
1775 .B \-X
1776 This is a dialect\-specific option.
1777 .HP \w'names'u+4
1778 \ \ \ \ AIX:
1779 .br
1780 This IBM AIX RISC/System 6000 option requests the reporting
1781 of executed text file and shared library references.
1782 .IP
1783 .B WARNING:
1784 because this option uses the kernel readx() function, its use on
1785 a busy AIX system might cause an application process to hang so
1786 completely that it can neither be killed nor stopped.
1787 I have never seen this happen or had a report of its happening,
1788 but I think there is a remote possibility it could happen.
1789 .IP
1790 By default use of readx() is disabled.
1791 On AIX 5L and above
1792 .I lsof
1793 may need setuid\-root permission to perform the actions this
1794 option requests.
1795 .IP
1796 The
1797 .I lsof
1798 builder may specify that the
1799 .B \-X
1800 option be restricted to processes whose real UID is root.
1801 If that has been done, the
1802 .B \-X
1803 option will not appear in the
1804 .B \-h
1805 or
1806 .B \-?
1807 help output unless the real UID of the
1808 .I lsof
1809 process is root.
1810 The default
1811 .I lsof
1812 distribution allows any UID to specify
1813 .BR \-X,
1814 so by default it will appear in the help output.
1815 .IP
1816 When AIX readx() use
1817 is disabled,
1818 .I lsof
1819 may not be able to report information for all text and loader file
1820 references, but it may also avoid exacerbating an AIX
1821 kernel directory search kernel error, known as the Stale Segment
1822 ID bug.
1823 .IP
1824 The readx() function, used by
1825 .I lsof
1826 or any other program to access some sections of kernel virtual
1827 memory, can trigger the Stale Segment ID bug.
1828 It can cause the kernel's dir_search() function to believe erroneously
1829 that part of an in\-memory copy of a file system directory has been
1830 zeroed.
1831 Another application process, distinct from
1832 .IR lsof ,
1833 asking the kernel to search the directory \- e.g., by using
1834 .IR open "(2) \-"
1835 can cause dir_search() to loop forever, thus hanging the application process.
1836 .IP
1837 Consult the
1838 .I lsof
1839 FAQ (The \fBFAQ\fP section gives its location.)
1840 and the
1841 .I 00README
1842 file of the
1843 .I lsof
1844 distribution for a more complete description of the Stale Segment ID bug,
1845 its APAR, and methods for defining readx() use when compiling
1846 .IR lsof .
1847 .HP \w'names'u+4
1848 \ \ \ \ Linux:
1849 .br
1850 This Linux option requests that
1851 .I lsof
1852 skip the reporting of information on all open TCP, UDP and UDPLITE IPv4
1853 and IPv6 files.
1854 .IP
1855 This Linux option is most useful when the system has an extremely
1856 large number of open TCP, UDP and UDPLITE files, the processing of whose
1857 information in the
1858 .I /proc/net/tcp*
1859 and
1860 .I /proc/net/udp*
1861 files would take
1862 .I lsof
1863 a long time, and whose reporting is not of interest.
1864 .IP
1865 Use this option with care and only when you are sure that the
1866 information you want
1867 .I lsof
1868 to display isn't associated with open TCP, UDP or UDPLITE socket files.
1869 .HP \w'names'u+4
1870 \ \ \ \ Solaris 10 and above:
1871 .br
1872 This Solaris 10 and above option requests the reporting of cached
1873 paths for files that have been deleted \- i.e., removed with
1874 .IR rm (1)
1875 or
1876 .IR unlink (2).
1877 .IP
1878 The cached path is followed by the string ``\ (deleted)'' to indicate
1879 that the path by which the file was opened has been deleted.
1880 .IP
1881 Because intervening changes made to the path \- i.e., renames with
1882 .IR mv (1)
1883 or
1884 .IR rename (2)
1885 \- are not recorded in the cached path, what
1886 .I lsof
1887 reports is only the path by which the file was opened, not its
1888 possibly different final path.
1889 .TP \w'names'u+4
1890 .BI \-z " [z]"
1891 specifies how Solaris 10 and higher zone information is to be handled.
1892 .IP
1893 Without a following argument \- e.g., NO
1894 .IR z " \-"
1895 the option specifies that zone names are to be listed in the ZONE
1896 output column.
1897 .IP
1898 The
1899 .B \-z
1900 option may be followed by a zone name,
1901 .BI z .
1902 That causes lsof to list only open files for processes in that zone.
1903 Multiple
1904 .BI \-z " z"
1905 option and argument pairs may be specified to form a list of named zones.
1906 Any open file of any process in any of the zones will be listed, subject
1907 to other conditions specified by other options and arguments.
1908 .TP \w'names'u+4
1909 .BI \-Z " [Z]"
1910 specifies how SELinux security contexts are to be handled.
1911 It and 'Z' field output character support are inhibited
1912 when SELinux is disabled in the running Linux kernel.
1913 See
1914 .B "OUTPUT FOR OTHER PROGRAMS"
1915 for more information on the 'Z' field output character.
1916 .IP
1917 Without a following argument \- e.g., NO
1918 .IR Z " \-"
1919 the option specifies that security contexts are to be listed in the
1920 SECURITY\-CONTEXT output column.
1921 .IP
1922 The
1923 .B \-Z
1924 option may be followed by a wildcard security context name,
1925 .BI Z .
1926 That causes lsof to list only open files for processes in that security
1927 context.
1928 Multiple
1929 .BI \-Z " Z"
1930 option and argument pairs may be specified to form a list of security
1931 contexts.
1932 Any open file of any process in any of the security contexts will be listed,
1933 subject to other conditions specified by other options and arguments.
1934 Note that
1935 .I Z
1936 can be A:B:C or *:B:C or A:B:* or *:*:C to match against the A:B:C context.
1937 .TP \w'names'u+4
1938 .B \-\-
1939 The double minus sign option is a marker that signals the end of
1940 the keyed options.
1941 It may be used, for example, when the first file name begins with
1942 a minus sign.
1943 It may also be used when the absence of a value for the last keyed
1944 option must be signified by the presence of a minus sign in the following
1945 option and before the start of the file names.
1946 .TP \w'names'u+4
1947 .I names
1948 These are path names of specific files to list.
1949 Symbolic links are resolved before use.
1950 The first name may be separated from the preceding options with
1951 the ``--'' option.
1952 .IP
1953 If a
1954 .I name
1955 is the mounted\-on directory of a file system or the device of the
1956 file system,
1957 .I lsof
1958 will list all the files open on the file system.
1959 To be considered a file system, the
1960 .I name
1961 must match a mounted\-on directory name in
1962 .IR mount (8)
1963 output, or match the name of a block device associated with a mounted\-on
1964 directory name.
1965 The
1966 .B +|\-f
1967 option may be used to force
1968 .I lsof
1969 to consider a
1970 .I name
1971 a file system identifier (\fB+f\fP) or a simple file (\fB\-f\fP).
1972 .IP
1973 If
1974 .I name
1975 is a path to a directory that is not the mounted\-on directory name of
1976 a file system, it is treated just as a regular file is treated \- i.e.,
1977 its listing is restricted to processes that have it open as a file or
1978 as a process\-specific directory, such as the root or current working
1979 directory.
1980 To request that
1981 .I lsof
1982 look for open files inside a directory name, use the
1983 .BI +d " s"
1984 and
1985 .BI +D " D"
1986 options.
1987 .IP
1988 If a
1989 .I name
1990 is the base name of a family of multiplexed files \- e.g, AIX's
1991 .IR /dev/pt[cs] " \-"
1992 .I lsof
1993 will list all the associated multiplexed files on the device that
1994 are open \- e.g.,
1995 .IR /dev/pt[cs]/1 ,
1996 .IR /dev/pt[cs]/2 ,
1997 etc.
1998 .IP
1999 If a
2000 .I name
2001 is a UNIX domain socket name,
2002 .I lsof
2003 will usually search for it by the characters of the name alone \- exactly as
2004 it is specified and is recorded in the kernel socket structure.
2005 (See the next paragraph for an exception to that rule for Linux.)
2006 Specifying a relative path \- e.g.,
2007 .I ./file
2008 \&\- in place of the
2009 file's absolute path \- e.g.,
2010 .I /tmp/file
2011 \&\- won't work because
2012 .I lsof
2013 must match the characters you specify with what it finds in the
2014 kernel UNIX domain socket structures.
2015 .IP
2016 If a
2017 .I name
2018 is a Linux UNIX domain socket name, in one case
2019 .I lsof
2020 is able to search for it by its device and inode number, allowing
2021 .I name
2022 to be a relative path.
2023 The case requires that the absolute path -- i.e., one beginning with a
2024 slash ('/') be used by the process that created the socket, and hence be
2025 stored in the
2026 .I /proc/net/unix
2027 file; and it requires that
2028 .I lsof
2029 be able to obtain the device and node numbers of both the absolute path in
2030 .I /proc/net/unix
2031 and
2032 .I name
2033 via successful
2034 .IR stat (2)
2035 system calls.
2036 When those conditions are met,
2037 .I lsof
2038 will be able to search for the UNIX domain socket when some path to it is
2039 is specified in
2040 .IR name .
2041 Thus, for example, if the path is
2042 .IR /dev/log ,
2043 and an
2044 .I lsof
2045 search is initiated when the working directory is
2046 .IR /dev ,
2047 then
2048 .I name
2049 could be
2050 .IR ./log .
2051 .IP
2052 If a
2053 .I name
2054 is none of the above,
2055 .I lsof
2056 will list any open files whose device and inode match that of the
2057 specified path
2058 .IR name .
2059 .IP
2060 If you have also specified the
2061 .B \-b
2062 option,
2063 the only
2064 .I names
2065 you may safely specify are file systems for which your mount table
2066 supplies alternate device numbers.
2067 See the
2068 .B "AVOIDING KERNEL BLOCKS"
2069 and
2070 .B "ALTERNATE DEVICE NUMBERS"
2071 sections for more information.
2072 .IP
2073 Multiple file names are joined in a single ORed set before
2074 participating in AND option selection.
2075 .SH AFS
2076 .I Lsof
2077 supports the recognition of AFS files for these dialects (and AFS
2078 versions):
2079 .PP
2080 .nf
2081         AIX 4.1.4 (AFS 3.4a)
2082         HP\-UX 9.0.5 (AFS 3.4a)
2083         Linux 1.2.13 (AFS 3.3)
2084         Solaris 2.[56] (AFS 3.4a)
2085 .fi
2086 .PP
2087 It may recognize AFS files on other versions of these dialects,
2088 but has not been tested there.
2089 Depending on how AFS is implemented,
2090 .I lsof
2091 may recognize AFS files in other dialects, or may have difficulties
2092 recognizing AFS files in the supported dialects.
2093 .PP
2094 .I Lsof
2095 may have trouble identifying all aspects of AFS files in
2096 supported dialects when AFS kernel support is implemented via
2097 dynamic modules whose addresses do not appear in the kernel's
2098 variable name list.
2099 In that case,
2100 .I lsof
2101 may have to guess at the identity of AFS files, and might not be able to
2102 obtain volume information from the kernel that is needed for calculating
2103 AFS volume node numbers.
2104 When
2105 .I lsof
2106 can't compute volume node numbers, it reports blank in the NODE column.
2107 .PP
2108 The
2109 .BI \-A " A"
2110 option is available in some dialect implementations of
2111 .I lsof
2112 for specifying the name list file where dynamic module kernel
2113 addresses may be found.
2114 When this option is available, it will be listed in the
2115 .I lsof
2116 help output, presented in response to the
2117 .B \-h
2118 or
2119 .B \-?
2120 .PP
2121 See the
2122 .I lsof
2123 FAQ (The \fBFAQ\fP section gives its location.)
2124 for more information about dynamic modules, their
2125 symbols, and how they affect
2126 .I lsof
2127 options.
2128 .PP
2129 Because AFS path lookups don't seem to participate in the
2130 kernel's name cache operations,
2131 .I lsof
2132 can't identify path name components for AFS files.
2133 .SH SECURITY
2134 .I Lsof
2135 has three features that may cause security concerns.
2136 First, its default compilation mode allows anyone to list all
2137 open files with it.
2138 Second, by default it creates a user\-readable and user\-writable device
2139 cache file in the home directory of the real user ID that executes
2140 .IR lsof .
2141 (The list\-all\-open\-files and device cache features may be disabled when
2142 .I lsof
2143 is compiled.)
2144 Third, its
2145 .B \-k
2146 and
2147 .B \-m
2148 options name alternate kernel name list or memory files.
2149 .PP
2150 Restricting the listing of all open files is controlled by the
2151 compile\-time HASSECURITY and HASNOSOCKSECURITY options.
2152 When HASSECURITY is defined,
2153 .I lsof
2154 will allow only the root user to list all open files.
2155 The non\-root user may list only open files of processes with the same user
2156 IDentification number as the real user ID number of the
2157 .I lsof
2158 process (the one that its user logged on with).
2159 .PP
2160 However, if HASSECURITY and HASNOSOCKSECURITY are both defined,
2161 anyone may list open socket files, provided they are selected
2162 with the
2163 .B \-i
2164 option.
2165 .PP
2166 When HASSECURITY is not defined, anyone may list all open files.
2167 .PP
2168 Help output, presented in response to the
2169 .B \-h
2170 or
2171 .B \-?
2172 option, gives the status of the HASSECURITY and HASNOSOCKSECURITY definitions.
2173 .PP
2174 See the
2175 .B Security
2176 section of the
2177 .I 00README
2178 file of the
2179 .I lsof
2180 distribution for information on building
2181 .I lsof
2182 with the HASSECURITY and HASNOSOCKSECURITY options enabled.
2183 .PP
2184 Creation and use of a user\-readable and user\-writable device
2185 cache file is controlled by the compile\-time HASDCACHE option.
2186 See the
2187 .B "DEVICE CACHE FILE"
2188 section and the sections that follow it for details on how its path
2189 is formed.
2190 For security considerations it is important to note that in the default
2191 .I lsof
2192 distribution, if the real user ID under which
2193 .I lsof
2194 is executed is root, the device cache file will be written in root's
2195 home directory \- e.g.,
2196 .I /
2197 or
2198 .IR /root .
2199 When HASDCACHE is not defined,
2200 .I lsof
2201 does not write or attempt to read a device cache file.
2202 .PP
2203 When HASDCACHE is defined, the
2204 .I lsof
2205 help output, presented in response to the
2206 .BR \-h ,
2207 .BR \-D? ,
2208 or
2209 .B \-?
2210 options, will provide device cache file handling information.
2211 When HASDCACHE is not defined, the
2212 .B \-h
2213 or
2214 .B \-?
2215 output will have no
2216 .B \-D
2217 option description.
2218 .PP
2219 Before you decide to disable the device cache file feature \- enabling
2220 it improves the performance of
2221 .I lsof
2222 by reducing the startup overhead of examining all the nodes in
2223 .I /dev
2224 (or
2225 .IR /devices )
2226 \&\- read the discussion of it in the
2227 .I 00DCACHE
2228 file of the
2229 .I lsof
2230 distribution and the
2231 .I lsof
2232 FAQ (The \fBFAQ\fP section gives its location.)
2233 .PP
2234 WHEN IN DOUBT, YOU CAN TEMPORARILY DISABLE THE USE OF THE DEVICE CACHE FILE
2235 WITH THE
2236 .B \-Di
2237 OPTION.
2238 .PP
2239 When
2240 .I lsof
2241 user declares alternate kernel name list or memory files with the
2242 .B \-k
2243 and
2244 .B \-m
2245 options,
2246 .I lsof
2247 checks the user's authority to read them with
2248 .IR access (2).
2249 This is intended to prevent whatever special power
2250 .I lsof's
2251 modes might confer on it from letting it read files not normally
2252 accessible via the authority of the real user ID.
2253 .SH OUTPUT
2254 This section describes the information
2255 .I lsof
2256 lists for each open file.
2257 See the
2258 .B "OUTPUT FOR OTHER PROGRAMS"
2259 section for additional information on output that can be processed
2260 by another program.
2261 .PP
2262 .I Lsof
2263 only outputs printable (declared so by
2264 .IR isprint (3))
2265 8 bit characters.
2266 Non\-printable characters are printed in one of three forms:
2267 the C ``\\[bfrnt]'' form;
2268 the control character `^' form (e.g., ``^@'');
2269 or hexadecimal leading ``\\x'' form (e.g., ``\\xab'').
2270 Space is non\-printable in the COMMAND column (``\\x20'')
2271 and printable elsewhere.
2272 .PP
2273 For some dialects \- if HASSETLOCALE is defined in the dialect's
2274 machine.h header file \-
2275 .I lsof
2276 will print the extended 8 bit characters of a language locale.
2277 The
2278 .I lsof
2279 process must be supplied a language locale environment variable
2280 (e.g., LANG) whose value represents a known language locale
2281 in which the extended characters are considered printable by
2282 .IR isprint (3).
2283 Otherwise
2284 .I lsof
2285 considers the extended characters non\-printable and prints them according
2286 to its rules for non\-printable characters, stated above.
2287 Consult your dialect's
2288 .IR setlocale (3)
2289 man page for the names of other environment variables that may
2290 be used in place of LANG \- e.g., LC_ALL, LC_CTYPE, etc.
2291 .PP
2292 .I Lsof's
2293 language locale support for a dialect also covers wide characters \- e.g.,
2294 UTF-8 \- when HASSETLOCALE and HASWIDECHAR are defined in the dialect's
2295 machine.h header file, and when a suitable language locale has been defined
2296 in the appropriate environment variable for the
2297 .I lsof
2298 process.
2299 Wide characters are printable under those conditions if
2300 .IR iswprint (3)
2301 reports them to be.
2302 If HASSETLOCALE, HASWIDECHAR and a suitable language locale aren't defined,
2303 or if
2304 .IR iswprint (3)
2305 reports wide characters that aren't printable,
2306 .I lsof
2307 considers the wide characters non\-printable and prints each of their
2308 8 bits according to its rules for non\-printable characters, stated above.
2309 .PP
2310 Consult the answers to the "Language locale support" questions in the
2311 lsof FAQ (The \fBFAQ\fP section gives its location.) for more information.
2312 .PP
2313 .I Lsof
2314 dynamically sizes the output columns each time it runs, guaranteeing
2315 that each column is a minimum size.
2316 It also guarantees that each column is separated from its predecessor
2317 by at least one space.
2318 .TP \w'COMMAND'u+4
2319 COMMAND
2320 contains the first nine characters of the name of the UNIX command
2321 associated with the process.
2322 If a non\-zero
2323 .I w
2324 value is specified to the
2325 .BI +c " w"
2326 option, the column contains the first
2327 .I w
2328 characters of the name of the UNIX command associated with the process
2329 up to the limit of characters supplied to
2330 .I lsof
2331 by the UNIX dialect.
2332 (See the description of the
2333 .BI +c " w"
2334 command or the
2335 .I lsof
2336 FAQ for more information.
2337 The \fBFAQ\fP section gives its location.)
2338 .IP
2339 If
2340 .I w
2341 is less than the length of the column title, ``COMMAND'', it will
2342 be raised to that length.
2343 .IP
2344 If a zero
2345 .I w
2346 value is specified to the
2347 .BI +c " w"
2348 option, the column contains all the characters of the name of the UNIX command
2349 associated with the process.
2350 .IP
2351 All command name characters maintained by the kernel in its structures
2352 are displayed in field output when the command name descriptor (`c')
2353 is specified.
2354 See the
2355 .B "OUTPUT FOR OTHER COMMANDS"
2356 section for information on selecting field output and the associated
2357 command name descriptor.
2358 .TP
2359 PID
2360 is the Process IDentification number of the process.
2361 .TP
2362 TID
2363 is the task (thread) IDentification number, if task (thread)
2364 reporting is supported by the dialect and a task (thread) is
2365 being listed.
2366 (If help output \- i.e., the output of the
2367 .B \-h
2368 or
2369 .B \-?
2370 options \- shows this option, then task (thread) reporting is
2371 supported by the dialect.)
2372 .IP
2373 A blank TID column in Linux indicates a process \- i.e., a non\-task.
2374 .TP
2375 TASKCMD
2376 is the task command name.
2377 Generally this will be the same as the process named in the COMMAND
2378 column, but some task implementations (e.g., Linux) permit a task to
2379 change its command name.
2380 .IP
2381 The TASKCMD column width is subject to the same size limitation as the
2382 COMMAND column.
2383 .TP
2384 ZONE
2385 is the Solaris 10 and higher zone name.
2386 This column must be selected with the
2387 .B \-z
2388 option.
2389 .TP
2390 SECURITY\-CONTEXT
2391 is the SELinux security context.
2392 This column must be selected with the
2393 .B -Z
2394 option.
2395 Note that the
2396 .B -Z
2397 option is inhibited when SELinux is disabled in the running Linux
2398 kernel.
2399 .TP
2400 PPID
2401 is the Parent Process IDentification number of the process.
2402 It is only displayed when the
2403 .B \-R
2404 option has been specified.
2405 .TP
2406 PGID
2407 is the process group IDentification number associated with
2408 the process.
2409 It is only displayed when the
2410 .B \-g
2411 option has been specified.
2412 .TP
2413 USER
2414 is the user ID number or login name of the user to whom
2415 the process belongs, usually the same as reported by
2416 .IR ps (1).
2417 However, on Linux USER is the user ID number or login that owns
2418 the directory in /proc where
2419 .I lsof
2420 finds information about the process.
2421 Usually that is the same value reported by
2422 .IR ps (1),
2423 but may differ when the process has changed its effective user ID.
2424 (See the
2425 .B \-l
2426 option description for information on when a user ID number or
2427 login name is displayed.)
2428 .TP
2429 FD
2430 is the File Descriptor number of the file or:
2431 .IP
2432 .nf
2433         \fBcwd\fP       current working directory;
2434 .br
2435         \fBL\fInn\fR    library references (AIX);
2436 .br
2437         \fBerr\fR       FD information error (see NAME column);
2438 .br
2439         \fBjld\fR       jail directory (FreeBSD);
2440 .br
2441         \fBltx\fP       shared library text (code and data);
2442 .br
2443         \fBMxx\fP       hex memory\-mapped type number xx.
2444 .br
2445         \fBm86\fP       DOS Merge mapped file;
2446 .br
2447         \fBmem\fP       memory\-mapped file;
2448 .br
2449         \fBmmap\fP      memory\-mapped device;
2450 .br
2451         \fBpd\fP        parent directory;
2452 .br
2453         \fBrtd\fP       root directory;
2454 .br
2455         \fBtr\fR        kernel trace file (OpenBSD);
2456 .br
2457         \fBtxt\fP       program text (code and data);
2458 .br
2459         \fBv86\fP       VP/ix mapped file;
2460 .fi
2461 .IP
2462 FD is followed by one of these characters, describing the mode under which
2463 the file is open:
2464 .IP
2465         \fBr\fP for read access;
2466 .br
2467         \fBw\fP for write access;
2468 .br
2469         \fBu\fP for read and write access;
2470 .br
2471         space if mode unknown and no lock
2472 .br
2473                 character follows;
2474 .br
2475         `\-' if mode unknown and lock
2476 .br
2477                 character follows.
2478 .IP
2479 The mode character is followed by one of these lock characters, describing
2480 the type of lock applied to the file:
2481 .IP
2482         \fBN\fP for a Solaris NFS lock of unknown type;
2483 .br
2484         \fBr\fP for read lock on part of the file;
2485 .br
2486         \fBR\fP for a read lock on the entire file;
2487 .br
2488         \fBw\fP for a write lock on part of the file;
2489 .br
2490         \fBW\fP for a write lock on the entire file;
2491 .br
2492         \fBu\fP for a read and write lock of any length;
2493 .br
2494         \fBU\fP for a lock of unknown type;
2495 .br
2496         \fBx\fP for an SCO OpenServer Xenix lock on part
2497         of the file;
2498 .br
2499         \fBX\fP for an SCO OpenServer Xenix lock on the entire file;
2500 .br
2501         space if there is no lock.
2502 .IP
2503 See the
2504 .B LOCKS
2505 section for more information on the lock information character.
2506 .IP
2507 The FD column contents constitutes a single field for parsing in
2508 post\-processing scripts.
2509 .TP
2510 TYPE
2511 is the type of the node associated with the file \- e.g., GDIR, GREG,
2512 VDIR, VREG, etc.
2513 .IP
2514 or ``IPv4'' for an IPv4 socket;
2515 .IP
2516 or ``IPv6'' for an open IPv6 network file \- even if its address is
2517 IPv4, mapped in an IPv6 address;
2518 .IP
2519 or ``ax25'' for a Linux AX.25 socket;
2520 .IP
2521 or ``inet'' for an Internet domain socket;
2522 .IP
2523 or ``lla'' for a HP\-UX link level access file;
2524 .IP
2525 or ``rte'' for an AF_ROUTE socket;
2526 .IP
2527 or ``sock'' for a socket of unknown domain;
2528 .IP
2529 or ``unix'' for a UNIX domain socket;
2530 .IP
2531 or ``x.25'' for an HP\-UX x.25 socket;
2532 .IP
2533 or ``BLK'' for a block special file;
2534 .IP
2535 or ``CHR'' for a character special file;
2536 .IP
2537 or ``DEL'' for a Linux map file that has been deleted;
2538 .IP
2539 or ``DIR'' for a directory;
2540 .IP
2541 or ``DOOR'' for a VDOOR file;
2542 .IP
2543 or ``FIFO'' for a FIFO special file;
2544 .IP
2545 or ``KQUEUE'' for a BSD style kernel event queue file;
2546 .IP
2547 or ``LINK'' for a symbolic link file;
2548 .IP
2549 or ``MPB'' for a multiplexed block file;
2550 .IP
2551 or ``MPC'' for a multiplexed character file;
2552 .IP
2553 or ``NOFD'' for a Linux /proc/<PID>/fd directory that can't be opened \--
2554 the directory path appears in the NAME column, followed by an error
2555 message;
2556 .IP
2557 or ``PAS'' for a
2558 .I /proc/as
2559 file;
2560 .IP
2561 or ``PAXV'' for a
2562 .I /proc/auxv
2563 file;
2564 .IP
2565 or ``PCRE'' for a
2566 .I /proc/cred
2567 file;
2568 .IP
2569 or ``PCTL'' for a
2570 .I /proc
2571 control file;
2572 .IP
2573 or ``PCUR'' for the current
2574 .I /proc
2575 process;
2576 .IP
2577 or ``PCWD'' for a
2578 .I /proc
2579 current working directory;
2580 .IP
2581 or ``PDIR'' for a
2582 .I /proc
2583 directory;
2584 .IP
2585 or ``PETY'' for a
2586 .I /proc
2587 executable type (\fIetype\fP);
2588 .IP
2589 or ``PFD'' for a
2590 .I /proc
2591 file descriptor;
2592 .IP
2593 or ``PFDR'' for a
2594 .I /proc
2595 file descriptor directory;
2596 .IP
2597 or ``PFIL'' for an executable
2598 .I /proc
2599 file;
2600 .IP
2601 or ``PFPR'' for a
2602 .I /proc
2603 FP register set;
2604 .IP
2605 or ``PGD'' for a
2606 .I /proc/pagedata
2607 file;
2608 .IP
2609 or ``PGID'' for a
2610 .I /proc
2611 group notifier file;
2612 .IP
2613 or ``PIPE'' for pipes;
2614 .IP
2615 or ``PLC'' for a
2616 .I /proc/lwpctl
2617 file;
2618 .IP
2619 or ``PLDR'' for a
2620 .I /proc/lpw
2621 directory;
2622 .IP
2623 or ``PLDT'' for a
2624 .I /proc/ldt
2625 file;
2626 .IP
2627 or ``PLPI'' for a
2628 .I /proc/lpsinfo
2629 file;
2630 .IP
2631 or ``PLST'' for a
2632 .I /proc/lstatus
2633 file;
2634 .IP
2635 or ``PLU'' for a
2636 .I /proc/lusage
2637 file;
2638 .IP
2639 or ``PLWG'' for a
2640 .I /proc/gwindows
2641 file;
2642 .IP
2643 or ``PLWI'' for a
2644 .I /proc/lwpsinfo
2645 file;
2646 .IP
2647 or ``PLWS'' for a
2648 .I /proc/lwpstatus
2649 file;
2650 .IP
2651 or ``PLWU'' for a
2652 .I /proc/lwpusage
2653 file;
2654 .IP
2655 or ``PLWX'' for a
2656 .I /proc/xregs
2657 file;
2658 .IP
2659 or ``PMAP'' for a
2660 .I /proc
2661 map file (\fImap\fP);
2662 .IP
2663 or ``PMEM'' for a
2664 .I /proc
2665 memory image file;
2666 .IP
2667 or ``PNTF'' for a
2668 .I /proc
2669 process notifier file;
2670 .IP
2671 or ``POBJ'' for a
2672 .I /proc/object
2673 file;
2674 .IP
2675 or ``PODR'' for a
2676 .I /proc/object
2677 directory;
2678 .IP
2679 or ``POLP'' for an old format
2680 .I /proc
2681 light weight process file;
2682 .IP
2683 or ``POPF'' for an old format
2684 .I /proc
2685 PID file;
2686 .IP
2687 or ``POPG'' for an old format
2688 .I /proc
2689 page data file;
2690 .IP
2691 or ``PORT'' for a SYSV named pipe;
2692 .IP
2693 or ``PREG'' for a
2694 .I /proc
2695 register file;
2696 .IP
2697 or ``PRMP'' for a
2698 .I /proc/rmap
2699 file;
2700 .IP
2701 or ``PRTD'' for a
2702 .I /proc
2703 root directory;
2704 .IP
2705 or ``PSGA'' for a
2706 .I /proc/sigact
2707 file;
2708 .IP
2709 or ``PSIN'' for a
2710 .I /proc/psinfo
2711 file;
2712 .IP
2713 or ``PSTA'' for a
2714 .I /proc
2715 status file;
2716 .IP
2717 or ``PSXSEM'' for a POSIX semaphore file;
2718 .IP
2719 or ``PSXSHM'' for a POSIX shared memory file;
2720 .IP
2721 or ``PTS'' for a
2722 .I /dev/pts
2723 file;
2724 .IP
2725 or ``PUSG'' for a
2726 .I /proc/usage
2727 file;
2728 .IP
2729 or ``PW'' for a
2730 .I /proc/watch
2731 file;
2732 .IP
2733 or ``PXMP'' for a
2734 .I /proc/xmap
2735 file;
2736 .IP
2737 or ``REG'' for a regular file;
2738 .IP
2739 or ``SMT'' for a shared memory transport file;
2740 .IP
2741 or ``STSO'' for a stream socket;
2742 .IP
2743 or ``UNNM'' for an unnamed type file;
2744 .IP
2745 or ``XNAM'' for an OpenServer Xenix special file of unknown type;
2746 .IP
2747 or ``XSEM'' for an OpenServer Xenix semaphore file;
2748 .IP
2749 or ``XSD'' for an OpenServer Xenix shared data file;
2750 .IP
2751 or the four type number octets if the corresponding name isn't known.
2752 .TP
2753 FILE\-ADDR
2754 contains the kernel file structure address when
2755 .B f
2756 has been specified to
2757 .BR +f ;
2758 .TP
2759 FCT
2760 contains the file reference count from the kernel file structure when
2761 .B c
2762 has been specified to
2763 .BR +f ;
2764 .TP
2765 FILE\-FLAG
2766 when
2767 .B g
2768 or
2769 .B G
2770 has been specified to
2771 .BR +f ,
2772 this field contains the contents of the f_flag[s] member of the kernel
2773 file structure and the kernel's per\-process open file flags (if available);
2774 \&`G' causes them to be displayed in hexadecimal;
2775 \&`g', as short\-hand names;
2776 two lists may be displayed with entries separated by commas, the
2777 lists separated by a semicolon (`;');
2778 the first list may contain short\-hand names for f_flag[s] values from
2779 the following table:
2780 .IP
2781 .nf
2782         AIO             asynchronous I/O (e.g., FAIO)
2783         AP              append
2784         ASYN            asynchronous I/O (e.g., FASYNC)
2785         BAS             block, test, and set in use
2786         BKIU            block if in use
2787         BL              use block offsets
2788         BSK             block seek
2789         CA              copy avoid
2790         CIO             concurrent I/O
2791         CLON            clone
2792         CLRD            CL read
2793         CR              create
2794         DF              defer
2795         DFI             defer IND
2796         DFLU            data flush
2797         DIR             direct
2798         DLY             delay
2799         DOCL            do clone
2800         DSYN            data\-only integrity
2801         DTY             must be a directory
2802         EVO             event only
2803         EX              open for exec
2804         EXCL            exclusive open
2805         FSYN            synchronous writes
2806         GCDF            defer during unp_gc() (AIX)
2807         GCMK            mark during unp_gc() (AIX)
2808         GTTY            accessed via /dev/tty
2809         HUP             HUP in progress
2810         KERN            kernel
2811         KIOC            kernel\-issued ioctl
2812         LCK             has lock
2813         LG              large file
2814         MBLK            stream message block
2815         MK              mark
2816         MNT             mount
2817         MSYN            multiplex synchronization
2818         NATM            don't update atime
2819         NB              non\-blocking I/O
2820         NBDR            no BDRM check
2821         NBIO            SYSV non\-blocking I/O
2822         NBF             n\-buffering in effect
2823         NC              no cache
2824         ND              no delay
2825         NDSY            no data synchronization
2826         NET             network
2827         NFLK            don't follow links
2828         NMFS            NM file system
2829         NOTO            disable background stop
2830         NSH             no share
2831         NTTY            no controlling TTY
2832         OLRM            OLR mirror
2833         PAIO            POSIX asynchronous I/O
2834         PP              POSIX pipe
2835         R               read
2836         RC              file and record locking cache
2837         REV             revoked
2838         RSH             shared read
2839         RSYN            read synchronization
2840         RW              read and write access
2841         SL              shared lock
2842         SNAP            cooked snapshot
2843         SOCK            socket
2844         SQSH            Sequent shared set on open
2845         SQSV            Sequent SVM set on open
2846         SQR             Sequent set repair on open
2847         SQS1            Sequent full shared open
2848         SQS2            Sequent partial shared open
2849         STPI            stop I/O
2850         SWR             synchronous read
2851         SYN             file integrity while writing
2852         TCPM            avoid TCP collision
2853         TR              truncate
2854         W               write
2855         WKUP            parallel I/O synchronization
2856         WTG             parallel I/O synchronization
2857         VH              vhangup pending
2858         VTXT            virtual text
2859         XL              exclusive lock
2860 .fi
2861 .IP
2862 this list of names was derived from F* #define's in dialect header files
2863 <fcntl.h>, <linux</fs.h>, <sys/fcntl.c>, <sys/fcntlcom.h>, and <sys/file.h>;
2864 see the lsof.h header file for a list showing the correspondence
2865 between the above short\-hand names and the header file definitions;
2866 .IP
2867 the second list (after the semicolon) may contain short\-hand names
2868 for kernel per\-process open file flags from this table:
2869 .IP
2870 .nf
2871         ALLC            allocated
2872         BR              the file has been read
2873         BHUP            activity stopped by SIGHUP
2874         BW              the file has been written
2875         CLSG            closing
2876         CX              close\-on-exec (see fcntl(F_SETFD))
2877         LCK             lock was applied
2878         MP              memory\-mapped
2879         OPIP            open pending \- in progress
2880         RSVW            reserved wait
2881         SHMT            UF_FSHMAT set (AIX)
2882         USE             in use (multi\-threaded)
2883 .fi
2884 .TP
2885 NODE\-ID
2886 (or INODE\-ADDR for some dialects)
2887 contains a unique identifier for the file node (usually the kernel
2888 vnode or inode address, but also occasionally a concatenation of
2889 device and node number) when
2890 .B n
2891 has been specified to
2892 .BR +f ;
2893 .TP
2894 DEVICE
2895 contains the device numbers, separated by commas, for a character special,
2896 block special, regular, directory or NFS file;
2897 .IP
2898 or ``memory'' for a memory file system node under Tru64 UNIX;
2899 .IP
2900 or the address of the private data area of a Solaris socket
2901 stream;
2902 .IP
2903 or a kernel reference address that identifies the file
2904 (The kernel reference address may be used for FIFO's, for example.);
2905 .IP
2906 or
2907 the base address or device name of a Linux AX.25 socket device.
2908 .IP
2909 Usually only the lower thirty two bits of Tru64 UNIX kernel addresses
2910 are displayed.
2911 .TP
2912 SIZE, SIZE/OFF, or OFFSET
2913 is the size of the file or the file offset in bytes.
2914 A value is displayed in this column only if it is available.
2915 .I Lsof
2916 displays whatever value \- size or offset \- is appropriate for the type
2917 of the file and the version of
2918 .IR lsof .
2919 .IP
2920 On some UNIX dialects
2921 .I lsof
2922 can't obtain accurate or consistent file offset information from its
2923 kernel data sources, sometimes just for particular kinds of files
2924 (e.g., socket files.)
2925 In other cases, files don't have true sizes \- e.g., sockets, FIFOs,
2926 pipes \- so
2927 .I lsof
2928 displays for their sizes the content amounts it finds in their kernel
2929 buffer descriptors (e.g., socket buffer size counts or TCP/IP window
2930 sizes.)
2931 Consult the
2932 .I lsof
2933 FAQ (The \fBFAQ\fP section gives its location.)
2934 for more information.
2935 .IP
2936 The file size is displayed in decimal;
2937 the offset is normally displayed in decimal with a leading ``0t'' if
2938 it contains 8 digits or less; in hexadecimal with a leading ``0x'' if
2939 it is longer than 8 digits.
2940 (Consult the
2941 .BI \-o " o"
2942 option description for information on when 8 might default to
2943 some other value.)
2944 .IP
2945 Thus the leading ``0t'' and ``0x'' identify an offset when the column
2946 may contain both a size and an offset (i.e., its title is SIZE/OFF).
2947 .IP
2948 If the
2949 .B \-o
2950 option is specified,
2951 .I lsof
2952 always displays the file offset (or nothing if no offset is available)
2953 and labels the column OFFSET.
2954 The offset always begins with ``0t'' or ``0x'' as described above.
2955 .IP
2956 The
2957 .I lsof
2958 user can control the switch from ``0t'' to ``0x'' with the
2959 .BI \-o " o"
2960 option.
2961 Consult its description for more information.
2962 .IP
2963 If the
2964 .B \-s
2965 option is specified,
2966 .I lsof
2967 always displays the file size (or nothing if no size is available)
2968 and labels the column SIZE.
2969 The
2970 .B \-o
2971 and
2972 .B \-s
2973 options are mutually exclusive; they can't both be specified.
2974 .IP
2975 For files that don't have a fixed size \- e.g., don't reside
2976 on a disk device \-
2977 .I lsof
2978 will display appropriate information about the current size or
2979 position of the file if it is available in the kernel structures
2980 that define the file.
2981 .TP
2982 NLINK
2983 contains the file link count when
2984 .B +L
2985 has been specified;
2986 .TP
2987 NODE
2988 is the node number of a local file;
2989 .IP
2990 or the inode number of an NFS file in the server host;
2991 .IP
2992 or the Internet protocol type \- e.g, ``TCP'';
2993 .IP
2994 or ``STR'' for a stream;
2995 .IP
2996 or ``CCITT'' for an HP\-UX x.25 socket;
2997 .IP
2998 or the IRQ or inode number of a Linux AX.25 socket device.
2999 .TP
3000 NAME
3001 is the name of the mount point and file system on which the file resides;
3002 .IP
3003 or the name of a file specified in the
3004 .I names
3005 option (after any symbolic links have been resolved);
3006 .IP
3007 or the name of a character special or block special device;
3008 .IP
3009 or the local and remote Internet addresses of a network file;
3010 the local host name or IP number is followed by a colon (':'), the
3011 port, ``->'', and the two\-part remote address;
3012 IP addresses may be reported as numbers or names, depending on the
3013 .BR +|\-M ,
3014 .BR \-n ,
3015 and
3016 .B \-P
3017 options;
3018 colon\-separated IPv6 numbers are enclosed in square brackets;
3019 IPv4 INADDR_ANY and IPv6 IN6_IS_ADDR_UNSPECIFIED addresses, and
3020 zero port numbers are represented by an asterisk ('*');
3021 a UDP destination address may be followed by the amount of time
3022 elapsed since the last packet was sent to the destination;
3023 TCP, UDP and UDPLITE remote addresses may be followed by TCP/TPI
3024 information in parentheses \- state (e.g., ``(ESTABLISHED)'', ``(Unbound)''),
3025 queue sizes, and window sizes (not all dialects) \- in a fashion
3026 similar to what
3027 .IR netstat (1)
3028 reports;
3029 see the
3030 .B \-T
3031 option description or the description of the TCP/TPI field in
3032 .B "OUTPUT FOR OTHER PROGRAMS"
3033 for more information on state, queue size, and window size;
3034 .IP
3035 or the address or name of a UNIX domain socket, possibly including
3036 a stream clone device name, a file system object's path name, local
3037 and foreign kernel addresses, socket pair information, and a bound
3038 vnode address;
3039 .IP
3040 or the local and remote mount point names of an NFS file;
3041 .IP
3042 or ``STR'', followed by the stream name;
3043 .IP
3044 or a stream character device name, followed by ``->'' and the stream name
3045 or a list of stream module names, separated by ``->'';
3046 .IP
3047 or ``STR:'' followed by the SCO OpenServer stream device and module
3048 names, separated by ``->'';
3049 .IP
3050 or system directory name, `` -- '', and as many components of the path
3051 name as
3052 .I lsof
3053 can find in the kernel's name cache for selected dialects
3054 (See the
3055 .B "KERNEL NAME CACHE"
3056 section for more information.);
3057 .IP
3058 or ``PIPE->'', followed by a Solaris kernel pipe destination address;
3059 .IP
3060 or ``COMMON:'', followed by the vnode device information structure's
3061 device name, for a Solaris common vnode;
3062 .IP
3063 or the address family, followed by a slash (`/'), followed by fourteen
3064 comma\-separated bytes of a non\-Internet raw socket address;
3065 .IP
3066 or the HP\-UX x.25 local address, followed by the virtual connection
3067 number (if any), followed by the remote address (if any);
3068 .IP
3069 or ``(dead)'' for disassociated Tru64 UNIX files \- typically terminal files
3070 that have been flagged with the TIOCNOTTY ioctl and closed by daemons;
3071 .IP
3072 or ``rd=<offset>'' and ``wr=<offset>'' for the values of the
3073 read and write offsets of a FIFO;
3074 .IP
3075 or ``clone \fIn\fP:/dev/event'' for SCO OpenServer file clones of the
3076 .I /dev/event
3077 device, where
3078 .I n
3079 is the minor device number of the file;
3080 .IP
3081 or ``(socketpair: n)'' for a Solaris 2.6, 8, 9  or 10
3082 UNIX domain socket, created by the
3083 .IR socketpair (3N)
3084 network function;
3085 .IP
3086 or ``no PCB'' for socket files that do not have a protocol block
3087 associated with them, optionally followed by ``, CANTSENDMORE'' if
3088 sending on the socket has been disabled, or ``, CANTRCVMORE'' if
3089 receiving on the socket has been disabled (e.g., by the
3090 .IR shutdown (2)
3091 function);
3092 .IP
3093 or the local and remote addresses of a Linux IPX socket file
3094 in the form <net>:[<node>:]<port>, followed in parentheses
3095 by the transmit and receive queue sizes, and the connection state;
3096 .IP
3097 or ``dgram'' or ``stream'' for the type UnixWare 7.1.1 and above in\-kernel
3098 UNIX domain sockets, followed by a colon (':') and the local path name
3099 when available, followed by ``->'' and the remote path name or kernel
3100 socket address in hexadecimal when available;
3101 .IP
3102 or the association value, association index, endpoint value, local address,
3103 local port, remote address and remote port for Linux SCTP sockets;
3104 .IP
3105 or ``protocol: '' followed by the Linux socket's protocol attribute.
3106 .PP
3107 For dialects that support a ``namefs'' file system, allowing one
3108 file to be attached to another with
3109 .IR fattach (3C),
3110 .I lsof
3111 will add ``(FA:<address1><direction><address2>)'' to the NAME column.
3112 <address1> and <address2> are hexadecimal vnode addresses.
3113 <direction> will be ``<-'' if <address2> has been fattach'ed to
3114 this vnode whose address is <address1>;
3115 and ``->'' if <address1>, the vnode address of this vnode, has been
3116 fattach'ed to <address2>.
3117 <address1> may be omitted if it already appears in the DEVICE column.
3118 .PP
3119 .I
3120 Lsof
3121 may add two parenthetical notes to the NAME column for open Solaris 10 files:
3122 \&``(?)'' if
3123 .I lsof
3124 considers the path name of questionable accuracy;
3125 and ``(deleted)'' if the
3126 .B \-X
3127 option has been specified and
3128 .I lsof
3129 detects the open file's path name has been deleted.
3130 Consult the
3131 .I lsof
3132 FAQ (The \fBFAQ\fP section gives its location.)
3133 for more information on these NAME column additions.
3134 .SH LOCKS
3135 .I Lsof
3136 can't adequately report the wide variety of UNIX dialect file locks
3137 in a single character.
3138 What it reports in a single character is a compromise between the
3139 information it finds in the kernel and the limitations of the reporting
3140 format.
3141 .PP
3142 Moreover, when a process holds several byte level locks on a file,
3143 .I lsof
3144 only reports the status of the first lock it encounters.
3145 If it is a byte level lock, then the lock character will be reported
3146 in lower case \- i.e., `r', `w', or `x' \- rather than the upper case
3147 equivalent reported for a full file lock.
3148 .PP
3149 Generally
3150 .I lsof
3151 can only report on locks held by local processes on local files.
3152 When a local process sets a lock on a remotely mounted (e.g., NFS)
3153 file, the remote server host usually records the lock state.
3154 One exception is Solaris \- at some patch levels of 2.3, and in all
3155 versions above 2.4, the Solaris kernel records information on remote
3156 locks in local structures.
3157 .PP
3158 .I Lsof
3159 has trouble reporting locks for some UNIX dialects.
3160 Consult the
3161 .B BUGS
3162 section of this manual page or the
3163 .I lsof
3164 FAQ (The \fBFAQ\fP section gives its location.)
3165 for more information.
3166 .SH "OUTPUT FOR OTHER PROGRAMS"
3167 When the
3168 .B \-F
3169 option is specified,
3170 .I lsof
3171 produces output that is suitable for processing by another program \- e.g, an
3172 .I awk
3173 or
3174 .I Perl
3175 script, or a C program.
3176 .PP
3177 Each unit of information is output in a field that is identified
3178 with a leading character and terminated by a NL (012) (or a NUL
3179 (000) if the 0 (zero) field identifier character is specified.)
3180 The data of the field follows immediately after the field identification
3181 character and extends to the field terminator.
3182 .PP
3183 It is possible to think of field output as process and file sets.
3184 A process set begins with a field whose identifier is `p' (for
3185 process IDentifier (PID)).
3186 It extends to the beginning of the next PID field or the beginning
3187 of the first file set of the process, whichever comes first.
3188 Included in the process set are fields that identify the command,
3189 the process group IDentification (PGID) number, the task (thread)
3190 ID (TID), and the user ID (UID) number or login name.
3191 .PP
3192 A file set begins with a field whose identifier is `f' (for
3193 file descriptor).
3194 It is followed by lines that describe the file's access mode,
3195 lock state, type, device, size, offset, inode, protocol, name
3196 and stream module names.
3197 It extends to the beginning of the next file or process set,
3198 whichever comes first.
3199 .PP
3200 When the NUL (000) field terminator has been selected with the
3201 0 (zero) field identifier character,
3202 .I lsof
3203 ends each process and file set with a NL (012) character.
3204 .PP
3205 .I Lsof
3206 always produces one field, the PID (`p') field.
3207 All other fields may be declared optionally in the field identifier
3208 character list that follows the
3209 .B \-F
3210 option.
3211 When a field selection character identifies an item
3212 .I lsof
3213 does not normally list \- e.g., PPID, selected with
3214 .BR \-R " \-"
3215 specification of the field character \- e.g., ``\fB\-FR\fP'' \-
3216 also selects the listing of the item.
3217 .PP
3218 It is entirely possible to select a set of fields that cannot
3219 easily be parsed \- e.g., if the field descriptor field is not
3220 selected, it may be difficult to identify file sets.
3221 To help you avoid this difficulty,
3222 .I lsof
3223 supports the
3224 .B \-F
3225 option; it selects the output of all fields with NL terminators
3226 (the
3227 .B \-F0
3228 option pair selects the output of all fields with NUL terminators).
3229 For compatibility reasons neither
3230 .B \-F
3231 nor
3232 .B \-F0
3233 select the raw device field.
3234 .PP
3235 These are the fields that
3236 .I lsof
3237 will produce.
3238 The single character listed first is the field identifier.
3239 .PP
3240 .nf
3241         a       file access mode
3242         c       process command name (all characters from proc or
3243                 user structure)
3244         C       file structure share count
3245         d       file's device character code
3246         D       file's major/minor device number (0x<hexadecimal>)
3247         f       file descriptor (always selected)
3248         F       file structure address (0x<hexadecimal>)
3249         G       file flaGs (0x<hexadecimal>; names if \fB+fg\fP follows)
3250         g       process group ID
3251         i       file's inode number
3252         K       tasK ID
3253         k       link count
3254         l       file's lock status
3255         L       process login name
3256         m       marker between repeated output
3257         M       the task comMand name
3258         n       file name, comment, Internet address
3259         N       node identifier (ox<hexadecimal>
3260         o       file's offset (decimal)
3261         p       process ID (always selected)
3262         P       protocol name
3263         r       raw device number (0x<hexadecimal>)
3264         R       parent process ID
3265         s       file's size (decimal)
3266         S       file's stream identification
3267         t       file's type
3268         T       TCP/TPI information, identified by prefixes (the
3269                 `=' is part of the prefix):
3270                     QR=<read queue size>
3271                     QS=<send queue size>
3272                     SO=<socket options and values> (not all dialects)
3273                     SS=<socket states> (not all dialects)
3274                     ST=<connection state>
3275                     TF=<TCP flags and values> (not all dialects)
3276                     WR=<window read size>  (not all dialects)
3277                     WW=<window write size>  (not all dialects)
3278                 (TCP/TPI information isn't reported for all supported
3279                   UNIX dialects. The \fB\-h\fP or \fB\-?\fP help output for the
3280                   \fB\-T\fP option will show what TCP/TPI reporting can be
3281                   requested.)
3282         u       process user ID
3283         z       Solaris 10 and higher zone name
3284         Z       SELinux security context (inhibited when SELinux is disabled)
3285         0       use NUL field terminator character in place of NL
3286         1\-9    dialect\-specific field identifiers (The output
3287                 of \fB\-F?\fP identifies the information to be found
3288                 in dialect\-specific fields.)
3289 .fi
3290 .PP
3291 You can get on\-line help information on these characters and their
3292 descriptions by specifying the
3293 .B \-F?
3294 option pair.
3295 (Escape the `?' character as your shell requires.)
3296 Additional information on field content can be found in the
3297 .B OUTPUT
3298 section.
3299 .PP
3300 As an example, ``\fB\-F pcfn\fP'' will select the process ID (`p'),
3301 command name (`c'), file descriptor (`f') and file name (`n')
3302 fields with an NL field terminator character; ``\fB\-F pcfn0\fP''
3303 selects the same output with a NUL (000) field terminator character.
3304 .PP
3305 .I Lsof
3306 doesn't produce all fields for every process or file set, only
3307 those that are available.
3308 Some fields are mutually exclusive: file device characters and
3309 file major/minor device numbers; file inode number and protocol
3310 name; file name and stream identification; file size and offset.
3311 One or the other member of these mutually exclusive sets will appear
3312 in field output, but not both.
3313 .PP
3314 Normally
3315 .I lsof
3316 ends each field with a NL (012) character.
3317 The
3318 0 (zero) field identifier character may be specified to change the
3319 field terminator character
3320 to a NUL (000).
3321 A NUL terminator may be easier to process with
3322 .I xargs (1),
3323 for example, or with programs whose quoting mechanisms may not
3324 easily cope with the range of characters in the field output.
3325 When the NUL field terminator is in use,
3326 .I lsof
3327 ends each process and file set with a NL (012).
3328 .PP
3329 Three aids to producing programs that can process
3330 .I lsof
3331 field output are included in the
3332 .I lsof
3333 distribution.
3334 The first is a C header file,
3335 .IR lsof_fields.h ,
3336 that contains symbols for the field identification characters, indexes for
3337 storing them in a table, and explanation strings that may be compiled into
3338 programs.
3339 .I Lsof
3340 uses this header file.
3341 .PP
3342 The second aid is a set of sample scripts that process field output,
3343 written in
3344 .IR awk ,
3345 .I Perl
3346 4, and
3347 .I Perl
3348 5.
3349 They're located in the
3350 .I scripts
3351 subdirectory of the
3352 .I lsof
3353 distribution.
3354 .PP
3355 The third aid is the C library used for the
3356 .I lsof
3357 test suite.
3358 The test suite is written in C and uses field output to validate
3359 the correct operation of
3360 .IR lsof .
3361 The library can be found in the
3362 .I tests/LTlib.c
3363 file of the
3364 .I lsof
3365 distribution.
3366 The library uses the first aid, the
3367 .I lsof_fields.h
3368 header file.
3369 .SH "BLOCKS AND TIMEOUTS"
3370 .I Lsof
3371 can be blocked by some kernel functions that it uses \-
3372 .IR lstat (2),
3373 .IR readlink (2),
3374 and
3375 .IR stat (2).
3376 These functions are stalled in the kernel, for example, when the
3377 hosts where mounted NFS file systems reside become inaccessible.
3378 .PP
3379 .I Lsof
3380 attempts to break these blocks with timers and child processes,
3381 but the techniques are not wholly reliable.
3382 When
3383 .I lsof
3384 does manage to break a block, it will report the break with an error
3385 message.
3386 The messages may be suppressed with the
3387 .B \-t
3388 and
3389 .B \-w
3390 options.
3391 .PP
3392 The default timeout value may be displayed with the
3393 .B \-h
3394 or
3395 .B \-?
3396 option, and it may be changed with the
3397 .BI \-S " [t]"
3398 option.
3399 The minimum for
3400 .I t
3401 is two seconds, but you should avoid small values, since slow system
3402 responsiveness can cause short timeouts to expire unexpectedly and
3403 perhaps stop
3404 .I lsof
3405 before it can produce any output.
3406 .PP
3407 When
3408 .I lsof
3409 has to break a block during its access of mounted file system
3410 information, it normally continues, although with less information
3411 available to display about open files.
3412 .PP
3413 .I Lsof
3414 can also be directed to avoid the protection of timers and child processes
3415 when using the kernel functions that might block by specifying the
3416 .B \-O
3417 option.
3418 While this will allow
3419 .I lsof
3420 to start up with less overhead, it exposes
3421 .I lsof
3422 completely to the kernel situations that might block it.
3423 Use this option cautiously.
3424 .SH "AVOIDING KERNEL BLOCKS"
3425 .PP
3426 You can use the
3427 .B \-b
3428 option to tell
3429 .I lsof
3430 to avoid using kernel functions that would block.
3431 Some cautions apply.
3432 .PP
3433 First, using this option usually requires that your system supply
3434 alternate device numbers in place of the device numbers that
3435 .I lsof
3436 would normally obtain with the
3437 .IR lstat (2)
3438 and
3439 .IR stat (2)
3440 kernel functions.
3441 See the
3442 .B "ALTERNATE DEVICE NUMBERS"
3443 section for more information on alternate device numbers.
3444 .PP
3445 Second, you can't specify
3446 .I names
3447 for
3448 .I lsof
3449 to locate unless they're file system names.
3450 This is because
3451 .I lsof
3452 needs to know the device and inode numbers of files listed with
3453 .I names
3454 in the
3455 .I lsof
3456 options, and the
3457 .B \-b
3458 option prevents
3459 .I lsof
3460 from obtaining them.
3461 Moreover, since
3462 .I lsof
3463 only has device numbers for the file systems that have alternates,
3464 its ability to locate files on file systems depends completely on the
3465 availability and accuracy of the alternates.
3466 If no alternates are available, or if they're incorrect,
3467 .I lsof
3468 won't be able to locate files on the named file systems.
3469 .PP
3470 Third, if the names of your file system directories that
3471 .I lsof
3472 obtains from your system's mount table are symbolic links,
3473 .I lsof
3474 won't be able to resolve the links.
3475 This is because the
3476 .B \-b
3477 option causes
3478 .I lsof
3479 to avoid the kernel
3480 .IR readlink (2)
3481 function it uses to resolve symbolic links.
3482 .PP
3483 Finally, using the
3484 .B \-b
3485 option causes
3486 .I lsof
3487 to issue warning messages when it needs to use the kernel functions
3488 that the
3489 .B \-b
3490 option directs it to avoid.
3491 You can suppress these messages by specifying the
3492 .B \-w
3493 option, but if you do, you won't see the alternate device numbers
3494 reported in the warning messages.
3495 .SH "ALTERNATE DEVICE NUMBERS"
3496 .PP
3497 On some dialects, when
3498 .I lsof
3499 has to break a block because it can't get information about a
3500 mounted file system via the
3501 .IR lstat (2)
3502 and
3503 .IR stat (2)
3504 kernel functions, or because you specified the
3505 .B \-b
3506 option,
3507 .I lsof
3508 can obtain some of the information it needs \- the device number and
3509 possibly the file system type \- from the system mount table.
3510 When that is possible,
3511 .I lsof
3512 will report the device number it obtained.
3513 (You can suppress the report by specifying the
3514 .B \-w
3515 option.)
3516 .PP
3517 You can assist this process if your mount table is supported with an
3518 .I /etc/mtab
3519 or
3520 .I /etc/mnttab
3521 file that contains an options field by adding a ``dev=xxxx'' field for
3522 mount points that do not have one in their options strings.
3523 Note: you must be able to edit the file \- i.e., some mount tables
3524 like recent Solaris /etc/mnttab or Linux /proc/mounts are read\-only
3525 and can't be modified.
3526 .PP
3527 You may also be able to supply device numbers using the
3528 .B +m
3529 and
3530 .BI +m " m"
3531 options, provided they are supported by your dialect.
3532 Check the output of
3533 .I lsof's
3534 .B \-h
3535 or
3536 .B \-?
3537 options to see if the
3538 .B +m
3539 and
3540 .BI +m " m"
3541 options are available.
3542 .PP
3543 The ``xxxx'' portion of the field is the hexadecimal value
3544 of the file system's device number.
3545 (Consult the
3546 .I st_dev
3547 field of the output of the
3548 .IR lstat (2)
3549 and
3550 .IR stat (2)
3551 functions for the appropriate values for your file systems.)
3552 Here's an example from a Sun Solaris 2.6
3553 .I /etc/mnttab
3554 for a file system remotely mounted via NFS:
3555 .PP
3556 .nf
3557         nfs  ignore,noquota,dev=2a40001
3558 .fi
3559 .PP
3560 There's an advantage to having ``dev=xxxx'' entries in your mount
3561 table file, especially for file systems that are mounted from remote
3562 NFS servers.
3563 When a remote server crashes and you want to identify its users by running
3564 .I lsof
3565 on one of its clients,
3566 .I lsof
3567 probably won't be able to get output from the
3568 .IR lstat (2)
3569 and
3570 .IR stat (2)
3571 functions for the file system.
3572 If it can obtain the file system's device number from the mount table,
3573 it will be able to display the files open on the crashed NFS server.
3574 .PP
3575 Some dialects that do not use an ASCII
3576 .I /etc/mtab
3577 or
3578 .I /etc/mnttab
3579 file for the mount table may still provide an alternative device number
3580 in their internal mount tables.
3581 This includes AIX, Apple Darwin, FreeBSD, NetBSD, OpenBSD, and Tru64 UNIX.
3582 .I Lsof
3583 knows how to obtain the alternative device number for these dialects
3584 and uses it when its attempt to
3585 .IR lstat (2)
3586 or
3587 .IR stat (2)
3588 the file system is blocked.
3589 .PP
3590 If you're not sure your dialect supplies alternate device numbers
3591 for file systems from its mount table, use this
3592 .I lsof
3593 incantation to see if it reports any alternate device numbers:
3594 .PP
3595 .IP
3596 lsof -b
3597 .PP
3598 Look for standard error file warning messages that
3599 begin ``assuming "dev=xxxx" from ...''.
3600 .SH "KERNEL NAME CACHE"
3601 .PP
3602 .I Lsof
3603 is able to examine the kernel's name cache or use other kernel
3604 facilities (e.g., the ADVFS 4.x tag_to_path() function under
3605 Tru64 UNIX) on some dialects for most file system types,
3606 excluding AFS, and extract recently used path name components from it.
3607 (AFS file system path lookups don't use the kernel's name cache; some
3608 Solaris VxFS file system operations apparently don't use it, either.)
3609 .PP
3610 .I Lsof
3611 reports the complete paths it finds in the NAME column.
3612 If
3613 .I lsof
3614 can't report all components in a path, it reports in the NAME column
3615 the file system name, followed by a space, two `-' characters, another
3616 space, and the name components it has located, separated by
3617 the `/' character.
3618 .PP
3619 When
3620 .I lsof
3621 is run in repeat mode \- i.e., with the
3622 .B \-r
3623 option specified \- the extent to which it can report path name
3624 components for the same file may vary from cycle to cycle.
3625 That's because other running processes can cause the kernel to
3626 remove entries from its name cache and replace them with others.
3627 .PP
3628 .I Lsof's
3629 use of the kernel name cache to identify the paths of files
3630 can lead it to report incorrect components under some circumstances.
3631 This can happen when the kernel name cache uses device and node
3632 number as a key (e.g., SCO OpenServer) and a key on a rapidly
3633 changing file system is reused.
3634 If the UNIX dialect's kernel doesn't purge the name cache entry for
3635 a file when it is unlinked,
3636 .I lsof
3637 may find a reference to the wrong entry in the cache.
3638 The
3639 .I lsof
3640 FAQ (The \fBFAQ\fP section gives its location.)
3641 has more information on this situation.
3642 .PP
3643 .I Lsof
3644 can report path name components for these dialects:
3645 .PP
3646 .nf
3647         FreeBSD
3648         HP\-UX
3649         Linux
3650         NetBSD
3651         NEXTSTEP
3652         OpenBSD
3653         OPENSTEP
3654         SCO OpenServer
3655         SCO|Caldera UnixWare
3656         Solaris
3657         Tru64 UNIX
3658 .fi
3659 .PP
3660 .I Lsof
3661 can't report path name components for these dialects:
3662 .PP
3663 .nf
3664         AIX
3665 .fi
3666 .PP
3667 If you want to know why
3668 .I lsof
3669 can't report path name components for some dialects, see the
3670 .I lsof
3671 FAQ (The \fBFAQ\fP section gives its location.)
3672 .SH "DEVICE CACHE FILE"
3673 .PP
3674 Examining all members of the
3675 .I /dev
3676 (or
3677 .IR /devices )
3678 node tree with
3679 .IR stat (2)
3680 functions can be time consuming.
3681 What's more, the information that
3682 .I lsof
3683 needs \- device number, inode number, and path \- rarely changes.
3684 .PP
3685 Consequently,
3686 .I lsof
3687 normally maintains an ASCII text file of cached
3688 .I /dev
3689 (or
3690 .IR /devices )
3691 information (exception: the /proc\-based Linux
3692 .I lsof
3693 where it's not needed.)
3694 The local system administrator who builds
3695 .I lsof
3696 can control the way the device cache file path is formed, selecting
3697 from these options:
3698 .PP
3699 .nf
3700         Path from the \fB\-D\fP option;
3701         Path from an environment variable;
3702         System\-wide path;
3703         Personal path (the default);
3704         Personal path, modified by an environment variable.
3705 .fi
3706 .PP
3707 Consult the output of the
3708 .BR \-h ,
3709 .B \-D? ,
3710 or
3711 .B \-?
3712 help options for the current state of device cache support.
3713 The help output lists the default read\-mode device cache file path that
3714 is in effect for the current invocation of
3715 .IR lsof .
3716 The
3717 .B \-D?
3718 option output lists the read\-only and write device cache file paths,
3719 the names of any applicable environment variables, and the personal
3720 device cache path format.
3721 .PP
3722 .I Lsof
3723 can detect that the current device cache file has been accidentally
3724 or maliciously modified by integrity checks, including the computation
3725 and verification of a sixteen bit Cyclic Redundancy Check (CRC) sum on
3726 the file's contents.
3727 When
3728 .I lsof
3729 senses something wrong with the file, it issues a warning and attempts
3730 to remove the current cache file and create a new copy, but only to
3731 a path that the process can legitimately write.
3732 .PP
3733 The path from which a
3734 .I lsof
3735 process may attempt to read a device cache file may not be the same
3736 as the path to which it can legitimately write.
3737 Thus when
3738 .I lsof
3739 senses that it needs to update the device cache file, it may
3740 choose a different path for writing it from the path from which
3741 it read an incorrect or outdated version.
3742 .PP
3743 If available, the
3744 .B \-Dr
3745 option will inhibit the writing of a new device cache file.
3746 (It's always available when specified without a path name argument.)
3747 .PP
3748 When a new device is added to the system, the device cache file may
3749 need to be recreated.
3750 Since
3751 .I lsof
3752 compares the mtime of the device cache file with the mtime and ctime
3753 of the
3754 .I /dev
3755 (or
3756 .IR /devices )
3757 directory, it usually detects that a new device has been added;
3758 in that case
3759 .I lsof
3760 issues a warning message and attempts to rebuild the device cache file.
3761 .PP
3762 Whenever
3763 .I lsof
3764 writes a device cache file, it sets its ownership to the real UID
3765 of the executing process, and its permission modes to 0600, this
3766 restricting its reading and writing to the file's owner.
3767 .SH "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
3768 .PP
3769 Two permissions of the
3770 .I lsof
3771 executable affect its ability to access device cache files.
3772 The permissions are set by the local system administrator when
3773 .I lsof
3774 is installed.
3775 .PP
3776 The first and rarer permission is setuid\-root.
3777 It comes into effect when
3778 .I lsof
3779 is executed; its effective UID is then
3780 root, while its real (i.e., that of the logged\-on user) UID is not.
3781 The
3782 .I lsof
3783 distribution recommends that versions for these dialects run setuid\-root.
3784 .PP
3785 .nf
3786         HP-UX 11.11 and 11.23
3787         Linux
3788 .fi
3789 .PP
3790 The second and more common permission is setgid.
3791 It comes into effect when the effective group IDentification number (GID)
3792 of the
3793 .I lsof
3794 process is set to one that can access kernel memory devices \-
3795 e.g., ``kmem'', ``sys'', or ``system''.
3796 .PP
3797 An
3798 .I lsof
3799 process that has setgid permission usually surrenders the permission
3800 after it has accessed the kernel memory devices.
3801 When it does that,
3802 .I lsof
3803 can allow more liberal device cache path formations.
3804 The
3805 .I lsof
3806 distribution recommends that versions for these dialects run setgid
3807 and be allowed to surrender setgid permission.
3808 .PP
3809 .nf
3810         AIX 5.[12] and 5.3-ML1
3811         Apple Darwin 7.x Power Macintosh systems
3812         FreeBSD 4.x, 4.1x, 5.x and [6789].x for x86-based systems
3813         FreeBSD 5.x, [6789].x and 1[012].8for Alpha, AMD64 and Sparc64
3814             based systems
3815         HP\-UX 11.00
3816         NetBSD 1.[456], 2.x and 3.x for Alpha, x86, and SPARC-based
3817             systems
3818         NEXTSTEP 3.[13] for NEXTSTEP architectures
3819         OpenBSD 2.[89] and 3.[0\-9] for x86-based systems
3820         OPENSTEP 4.x
3821         SCO OpenServer Release 5.0.6 for x86-based systems
3822         SCO|Caldera UnixWare 7.1.4 for x86-based systems
3823         Solaris 2.6, 8, 9 and 10
3824         Tru64 UNIX 5.1
3825 .fi
3826 .PP
3827 (Note:
3828 .I lsof
3829 for AIX 5L and above needs setuid\-root permission if its
3830 .B \-X
3831 option is used.)
3832 .PP
3833 .I Lsof
3834 for these dialects does not support a device cache, so the permissions
3835 given to the executable don't apply to the device cache file.
3836 .PP
3837 .nf
3838         Linux
3839 .fi
3840 .SH "DEVICE CACHE FILE PATH FROM THE \-D OPTION"
3841 .PP
3842 The
3843 .B \-D
3844 option provides limited means for specifying the device cache file path.
3845 Its
3846 .B ?
3847 function will report the read\-only and write device cache file paths that
3848 .I lsof
3849 will use.
3850 .PP
3851 When the
3852 .B \-D
3853 .BR b ,
3854 .BR r ,
3855 and
3856 .B u
3857 functions are available, you can use them to request that the cache file be
3858 built in a specific location (\fBb\fR[\fIpath\fR]);
3859 read but not rebuilt (\fBr\fR[\fIpath\fR]);
3860 or read and rebuilt (\fBu\fR[\fIpath\fR]).
3861 The
3862 .BR b ,
3863 .BR r ,
3864 and
3865 .B u
3866 functions are restricted under some conditions.
3867 They are restricted when the
3868 .I lsof
3869 process is setuid\-root.
3870 The path specified with the
3871 .B r
3872 function is always read\-only, even
3873 when it is available.
3874 .PP
3875 The
3876 .BR b ,
3877 .BR r ,
3878 and
3879 .B u
3880 functions are also restricted when the
3881 .I lsof
3882 process runs setgid and
3883 .I lsof
3884 doesn't surrender the setgid permission.
3885 (See the
3886 .B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
3887 section for a list of implementations that normally don't surrender
3888 their setgid permission.)
3889 .PP
3890 A further
3891 .B \-D
3892 function,
3893 .B i
3894 (for ignore), is always available.
3895 .PP
3896 When available, the
3897 .B b
3898 function tells
3899 .I lsof
3900 to read device information from the kernel with the
3901 .IR stat (2)
3902 function and build a device cache file at the indicated path.
3903 .PP
3904 When available, the
3905 .B r
3906 function tells
3907 .I lsof
3908 to read the device cache file, but not update it.
3909 When a path argument accompanies
3910 .BR \-Dr ,
3911 it names the device cache file path.
3912 The
3913 .B r
3914 function is always available when it is specified without a
3915 path name argument.
3916 If
3917 .I lsof
3918 is not running setuid\-root and surrenders its setgid permission,
3919 a path name argument may accompany the
3920 .B r
3921 function.
3922 .PP
3923 When available, the
3924 .B u
3925 function tells
3926 .I lsof
3927 to attempt to read and use the device cache file.
3928 If it can't read the file, or if it finds the contents of the
3929 file incorrect or outdated, it will read information from the kernel,
3930 and attempt to write an updated version of the device cache file,
3931 but only to a path it considers legitimate for the
3932 .I lsof
3933 process effective and real UIDs.
3934 .SH "DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE"
3935 .PP
3936 .I Lsof's
3937 second choice for the device cache file is the contents of the
3938 LSOFDEVCACHE environment variable.
3939 It avoids this choice if the
3940 .I lsof
3941 process is setuid\-root, or the real UID of the process is root.
3942 .PP
3943 A further restriction applies to a device cache file path taken from
3944 the LSOFDEVCACHE environment variable:
3945 .I lsof
3946 will not write a device cache file to the path if the
3947 .I lsof
3948 process doesn't surrender its setgid permission.
3949 (See the
3950 .B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
3951 section for information on implementations that don't surrender
3952 their setgid permission.)
3953 .PP
3954 The local system administrator can disable the use of the LSOFDEVCACHE
3955 environment variable or change its name when building
3956 .IR lsof .
3957 Consult the output of
3958 .B \-D?
3959 for the environment variable's name.
3960 .SH "SYSTEM-WIDE DEVICE CACHE PATH"
3961 .PP
3962 The local system administrator may choose to have a system\-wide
3963 device cache file when building
3964 .IR lsof .
3965 That file will generally be constructed by a special system administration
3966 procedure when the system is booted or when the contents of
3967 .I /dev
3968 or
3969 .IR /devices )
3970 changes.
3971 If defined, it is
3972 .I lsof's
3973 third device cache file path choice.
3974 .PP
3975 You can tell that a system\-wide device cache file is in effect
3976 for your local installation by examining the
3977 .I lsof
3978 help option output \- i.e., the output from the
3979 .B \-h
3980 or
3981 .B \-?
3982 option.
3983 .PP
3984 .I Lsof
3985 will never write to the system\-wide device cache file path by
3986 default.
3987 It must be explicitly named with a
3988 .B \-D
3989 function in a root\-owned procedure.
3990 Once the file has been written, the procedure must change its permission
3991 modes to 0644 (owner\-read and owner\-write, group\-read, and other\-read).
3992 .SH "PERSONAL DEVICE CACHE PATH (DEFAULT)"
3993 .PP
3994 The default device cache file path of the
3995 .I lsof
3996 distribution is one recorded in the home directory of the real UID
3997 that executes
3998 .IR lsof .
3999 Added to the home directory is a second path component of the form
4000 .IR .lsof_hostname .
4001 .PP
4002 This is
4003 .I lsof's
4004 fourth device cache file path choice, and is
4005 usually the default.
4006 If a system\-wide device cache file path was defined when
4007 .I lsof
4008 was built,
4009 this fourth choice will be applied when
4010 .I lsof
4011 can't find the system\-wide device cache file.
4012 This is the
4013 .B only
4014 time
4015 .I lsof
4016 uses two paths when reading the device cache file.
4017 .PP
4018 The
4019 .I hostname
4020 part of the second component is the base
4021 name of the executing host, as returned by
4022 .IR gethostname (2).
4023 The base name is defined to be the characters preceding the first `.'
4024 in the
4025 .IR gethostname (2)
4026 output, or all the
4027 .IR gethostname (2)
4028 output if it contains no `.'.
4029 .PP
4030 The device cache file belongs to the user ID and is readable and
4031 writable by the user ID alone \- i.e., its modes are 0600.
4032 Each distinct real user ID on a given host that executes
4033 .I lsof
4034 has a distinct device cache file.
4035 The
4036 .I hostname
4037 part of the path distinguishes device cache files in an NFS\-mounted
4038 home directory into which device cache files are written from
4039 several different hosts.
4040 .PP
4041 The personal device cache file path formed by this method represents
4042 a device cache file that
4043 .I lsof
4044 will attempt to read, and will attempt to write should it not
4045 exist or should its contents be incorrect or outdated.
4046 .PP
4047 The
4048 .B \-Dr
4049 option without a path name argument will inhibit the writing of a new
4050 device cache file.
4051 .PP
4052 The
4053 .B \-D?
4054 option will list the format specification for constructing the
4055 personal device cache file.
4056 The conversions used in the format specification are described in the
4057 .I 00DCACHE
4058 file of the
4059 .I lsof
4060 distribution.
4061 .SH "MODIFIED PERSONAL DEVICE CACHE PATH"
4062 .PP
4063 If this option is defined by the local system administrator when
4064 .I lsof
4065 is built, the LSOFPERSDCPATH environment variable contents may
4066 be used to add a component of the personal device cache file path.
4067 .PP
4068 The LSOFPERSDCPATH variable contents are inserted in the path at the
4069 place marked by the local system administrator with the ``%p''
4070 conversion in the HASPERSDC format specification of the dialect's
4071 .I machine.h
4072 header file.
4073 (It's placed right after the home directory in the default
4074 .I lsof
4075 distribution.)
4076 .PP
4077 Thus, for example, if LSOFPERSDCPATH contains ``LSOF'', the home
4078 directory is ``/Homes/abe'', the host name is ``lsof.itap.purdue.edu'',
4079 and the HASPERSDC format is the default (``%h/%p.lsof_%L''), the
4080 modified personal device cache file path is:
4081 .PP
4082 .nf
4083         /Homes/abe/LSOF/.lsof_vic
4084 .fi
4085 .PP
4086 The LSOFPERSDCPATH environment variable is ignored when the
4087 .I lsof
4088 process is setuid\-root or when the real UID of the process is root.
4089 .PP
4090 .I Lsof
4091 will not write to a modified personal device cache file path if the
4092 .I lsof
4093 process doesn't surrender setgid permission.
4094 (See the
4095 .B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
4096 section for a list of implementations that normally don't surrender
4097 their setgid permission.)
4098 .PP
4099 If, for example, you want to create a sub\-directory of personal
4100 device cache file paths by using the LSOFPERSDCPATH environment
4101 variable to name it, and
4102 .I lsof
4103 doesn't surrender its setgid permission, you will have to allow
4104 .I lsof
4105 to create device cache files at the standard personal path and
4106 move them to your subdirectory with shell commands.
4107 .PP
4108 The local system administrator may: disable this option when
4109 .I lsof
4110 is built; change the name of the environment variable from
4111 LSOFPERSDCPATH to something else; change the HASPERSDC
4112 format to include the personal path component in another place;
4113 or exclude the personal path component entirely.
4114 Consult the output of the
4115 .B \-D?
4116 option for the environment variable's name and the HASPERSDC
4117 format specification.
4118 .SH DIAGNOSTICS
4119 Errors are identified with messages on the standard error file.
4120 .PP
4121 .I Lsof
4122 returns a one (1) if any error was detected, including the failure to
4123 locate command names, file names, Internet addresses or files, login
4124 names, NFS files, PIDs, PGIDs, or UIDs it was asked to list.
4125 If the
4126 .B \-V
4127 option is specified,
4128 .I lsof
4129 will indicate the search items it failed to list.
4130 .PP
4131 It returns a zero (0) if no errors were detected and if it was able to
4132 list some information about all the specified search arguments.
4133 .PP
4134 .PP
4135 When
4136 .I lsof
4137 cannot open access to
4138 .I /dev
4139 (or
4140 .IR /devices )
4141 or one of its subdirectories, or get information on a file in them with
4142 .IR stat (2),
4143 it issues a warning message and continues.
4144 That
4145 .I lsof
4146 will issue warning messages about inaccessible files in
4147 .I /dev
4148 (or
4149 .IR /devices )
4150 is indicated in its help output \- requested with the
4151 .B \-h
4152 or
4153 >B \-?
4154 options \-  with the message:
4155 .PP
4156 .nf
4157         Inaccessible /dev warnings are enabled.
4158 .fi
4159 .PP
4160 The warning message may be suppressed with the
4161 .B \-w
4162 option.
4163 It may also have been suppressed by the system administrator when
4164 .I lsof
4165 was compiled by the setting of the WARNDEVACCESS definition.
4166 In this case, the output from the help options will include the message:
4167 .PP
4168 .nf
4169         Inaccessible /dev warnings are disabled.
4170 .fi
4171 .PP
4172 Inaccessible device warning messages usually disappear after
4173 .I lsof
4174 has created a working device cache file.
4175 .SH EXAMPLES
4176 For a more extensive set of examples, documented more fully, see the
4177 .I 00QUICKSTART
4178 file of the
4179 .I lsof
4180 distribution.
4181 .PP
4182 To list all open files, use:
4183 .IP
4184 lsof
4185 .PP
4186 To list all open Internet, x.25 (HP\-UX), and UNIX domain files, use:
4187 .IP
4188 lsof -i -U
4189 .PP
4190 To list all open IPv4 network files in use by the process whose PID is
4191 1234, use:
4192 .IP
4193 lsof -i 4 -a -p 1234
4194 .PP
4195 Presuming the UNIX dialect supports IPv6, to list only open IPv6
4196 network files, use:
4197 .IP
4198 lsof -i 6
4199 .PP
4200 To list all files using any protocol on ports 513, 514, or 515 of host
4201 wonderland.cc.purdue.edu, use:
4202 .IP
4203 lsof -i @wonderland.cc.purdue.edu:513-515
4204 .PP
4205 To list all files using any protocol on any port of mace.cc.purdue.edu
4206 (cc.purdue.edu is the default domain), use:
4207 .IP
4208 lsof -i @mace
4209 .PP
4210 To list all open files for login name ``abe'', or user ID 1234, or
4211 process 456, or process 123, or process 789, use:
4212 .IP
4213 lsof -p 456,123,789 -u 1234,abe
4214 .PP
4215 To list all open files on device /dev/hd4, use:
4216 .IP
4217 lsof /dev/hd4
4218 .PP
4219 To find the process that has /u/abe/foo open, use:
4220 .IP
4221 lsof /u/abe/foo
4222 .PP
4223 To send a SIGHUP to the processes that have /u/abe/bar open, use:
4224 .IP
4225 kill -HUP `lsof -t /u/abe/bar`
4226 .PP
4227 To find any open file, including an open UNIX domain socket file,
4228 with the name
4229 .IR /dev/log ,
4230 use:
4231 .IP
4232 lsof /dev/log
4233 .PP
4234 To find processes with open files on the NFS file system named
4235 .I /nfs/mount/point
4236 whose server is inaccessible, and presuming your mount table supplies
4237 the device number for
4238 .IR /nfs/mount/point ,
4239 use:
4240 .IP
4241 lsof -b /nfs/mount/point
4242 .PP
4243 To do the preceding search with warning messages suppressed, use:
4244 .IP
4245 lsof -bw /nfs/mount/point
4246 .PP
4247 To ignore the device cache file, use:
4248 .IP
4249 lsof -Di
4250 .PP
4251 To obtain PID and command name field output for each process, file
4252 descriptor, file device number, and file inode number for each file
4253 of each process, use:
4254 .IP
4255 lsof -FpcfDi
4256 .PP
4257 To list the files at descriptors 1 and 3 of every process running the
4258 .I lsof
4259 command for login ID ``abe'' every 10 seconds, use:
4260 .IP
4261 lsof -c lsof -a -d 1 -d 3 -u abe -r10
4262 .PP
4263 To list the current working directory of processes running a command that
4264 is exactly four characters long and has an 'o' or 'O' in character three,
4265 use this regular expression form of the
4266 .BI \-c " c"
4267 option:
4268 .IP
4269 lsof -c /^..o.$/i -a -d cwd
4270 .PP
4271 To find an IP version 4 socket file by its associated numeric dot\-form
4272 address, use:
4273 .IP
4274 lsof -i@128.210.15.17
4275 .PP
4276 To find an IP version 6 socket file (when the UNIX dialect supports
4277 IPv6) by its associated numeric colon\-form address, use:
4278 .IP
4279 lsof -i@[0:1:2:3:4:5:6:7]
4280 .PP
4281 To find an IP version 6 socket file (when the UNIX dialect supports
4282 IPv6) by an associated numeric colon\-form address that has a run of
4283 zeroes in it \- e.g., the loop\-back address \- use:
4284 .IP
4285 lsof -i@[::1]
4286 .PP
4287 To obtain a repeat mode marker line that contains the current time, use:
4288 .IP
4289 lsof -rm====%T====
4290 .PP
4291 To add spaces to the previous marker line, use:
4292 .IP
4293 lsof -r "m==== %T ===="
4294 .SH BUGS
4295 Since
4296 .I lsof
4297 reads kernel memory in its search for open files, rapid changes in kernel
4298 memory may produce unpredictable results.
4299 .PP
4300 When a file has multiple record locks, the lock status character
4301 (following the file descriptor) is derived from a test of the first
4302 lock structure, not from any combination of the individual record
4303 locks that might be described by multiple lock structures.
4304 .PP
4305 .I Lsof
4306 can't search for files with restrictive access permissions by
4307 .I name
4308 unless it is installed with root set\-UID permission.
4309 Otherwise it is limited to searching for files to which its user
4310 or its set-GID group (if any) has access permission.
4311 .PP
4312 The display of the destination address of a raw socket (e.g., for
4313 .IR ping )
4314 depends on the UNIX operating system.
4315 Some dialects store the destination address in the raw socket's protocol
4316 control block, some do not.
4317 .PP
4318 .I Lsof
4319 can't always represent Solaris device numbers in the same way that
4320 .IR ls (1)
4321 does.
4322 For example, the major and minor device numbers that the
4323 .IR lstat (2)
4324 and
4325 .IR stat (2)
4326 functions report for the directory on which CD-ROM files are mounted
4327 (typically
4328 .IR /cdrom )
4329 are not the same as the ones that it reports for the device on which
4330 CD-ROM files are mounted (typically
4331 .IR /dev/sr0 ).
4332 (\fILsof\fP reports the directory numbers.)
4333 .PP
4334 The support for
4335 .I /proc
4336 file systems is available only for BSD and Tru64 UNIX dialects, Linux, and
4337 dialects derived from SYSV R4 \- e.g., FreeBSD, NetBSD, OpenBSD, Solaris,
4338 UnixWare.
4339 .PP
4340 Some
4341 .I /proc
4342 file items \- device number, inode number, and file size \-
4343 are unavailable in some dialects.
4344 Searching for files in a
4345 .I /proc
4346 file system may require that the full path name be specified.
4347 .PP
4348 No text (\fBtxt\fP) file descriptors are displayed for Linux
4349 processes.
4350 All entries for files other than the current working directory,
4351 the root directory, and numerical file descriptors are labeled
4352 .B mem
4353 descriptors.
4354 .PP
4355 .I Lsof
4356 can't search for Tru64 UNIX named pipes by name, because their kernel
4357 implementation of lstat(2) returns an improper device number for a
4358 named pipe.
4359 .PP
4360 .I Lsof
4361 can't report fully or correctly on HP\-UX 9.01, 10.20, and 11.00 locks
4362 because of insufficient access to kernel data or errors in the
4363 kernel data.
4364 See the
4365 .I lsof
4366 FAQ (The \fBFAQ\fP section gives its location.)
4367 for details.
4368 .PP
4369 The AIX SMT file type is a fabrication.
4370 It's made up for file structures whose type (15) isn't defined in the AIX
4371 .I /usr/include/sys/file.h
4372 header file.
4373 One way to create such file structures is to run X clients with the DISPLAY
4374 variable set to ``:0.0''.
4375 .PP
4376 The
4377 .BI +|\-f [cfgGn]
4378 option is not supported under /proc\-based Linux
4379 .IR lsof ,
4380 because it doesn't read kernel structures from kernel memory.
4381 .SH ENVIRONMENT
4382 .I Lsof
4383 may access these environment variables.
4384 .TP \w'LSOFPERSDCPATH'u+4
4385 LANG
4386 defines a language locale.
4387 See
4388 .IR setlocale (3)
4389 for the names of other variables that can be used in place
4390 of LANG \- e.g., LC_ALL, LC_TYPE, etc.
4391 .TP
4392 LSOFDEVCACHE
4393 defines the path to a device cache file.
4394 See the
4395 .B "DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE"
4396 section for more information.
4397 .TP
4398 LSOFPERSDCPATH
4399 defines the middle component of a modified personal device cache
4400 file path.
4401 See the
4402 .B "MODIFIED PERSONAL DEVICE CACHE PATH"
4403 section for more information.
4404 .SH FAQ
4405 Frequently-asked questions and their answers (an FAQ) are
4406 available in the
4407 .I 00FAQ
4408 file of the
4409 .I lsof
4410 distribution.
4411 .PP
4412 That file is also available via anonymous ftp from
4413 .I lsof.itap.purdue.edu
4414 at
4415 .IR pub/tools/unix/lsof FAQ .
4416 The URL is:
4417 .IP
4418 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
4419 .SH FILES
4420 .TP \w'.lsof_hostname'u+4
4421 .I /dev/kmem
4422 kernel virtual memory device
4423 .TP
4424 .I /dev/mem
4425 physical memory device
4426 .TP
4427 .I /dev/swap
4428 system paging device
4429 .TP
4430 .I .lsof_hostname
4431 .I lsof's
4432 device cache file
4433 (The suffix,
4434 .IR hostname ,
4435 is the first component of the host's name returned by
4436 .IR gethostname (2).)
4437 .SH AUTHORS
4438 .I Lsof
4439 was written by Victor A.\&Abell <abe@purdue.edu> of Purdue University.
4440 Many others have contributed to
4441 .IR lsof .
4442 They're listed in the
4443 .I 00CREDITS
4444 file of the
4445 .I lsof
4446 distribution.
4447 .SH DISTRIBUTION
4448 The latest distribution of
4449 .I lsof
4450 is available via anonymous ftp from the host
4451 .IR lsof.itap.purdue.edu .
4452 You'll find the
4453 .I lsof
4454 distribution in the
4455 .I pub/tools/unix/lsof
4456 directory.
4457 .PP
4458 You can also use this URL:
4459 .IP
4460 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
4461 .PP
4462 .I Lsof
4463 is also mirrored elsewhere.
4464 When you access
4465 .I lsof.itap.purdue.edu
4466 and change to its
4467 .I pub/tools/unix/lsof
4468 directory, you'll be given a list of some mirror sites.
4469 The
4470 .I pub/tools/unix/lsof
4471 directory also contains a more complete list in its
4472 .I mirrors
4473 file.
4474 Use mirrors with caution \- not all mirrors always have the latest
4475 .I lsof
4476 revision.
4477 .PP
4478 Some pre\-compiled
4479 .I Lsof
4480 executables are available on
4481 .IR lsof.itap.purdue.edu ,
4482 but their use is discouraged \- it's better that you build
4483 your own from the sources.
4484 If you feel you must use a pre\-compiled executable, please
4485 read the cautions that appear in the README files of the
4486 .I pub/tools/unix/lsof/binaries
4487 subdirectories and in the 00* files of the distribution.
4488 .PP
4489 More information on the
4490 .I lsof
4491 distribution can be found in its
4492 .I README.lsof_<version>
4493 file.
4494 If you intend to get the
4495 .I lsof
4496 distribution and build it, please read
4497 .I README.lsof_<version>
4498 and the other 00* files of the distribution before sending questions
4499 to the author.
4500 .SH SEE ALSO
4501 .PP
4502 Not all the following manual pages may exist in every UNIX
4503 dialect to which
4504 .I lsof
4505 has been ported.
4506 .PP
4507 access(2),
4508 awk(1),
4509 crash(1),
4510 fattach(3C),
4511 ff(1),
4512 fstat(8),
4513 fuser(1),
4514 gethostname(2),
4515 isprint(3),
4516 kill(1),
4517 localtime(3),
4518 lstat(2),
4519 modload(8),
4520 mount(8),
4521 netstat(1),
4522 ofiles(8L),
4523 perl(1),
4524 ps(1),
4525 readlink(2),
4526 setlocale(3),
4527 stat(2),
4528 strftime(3),
4529 time(2),
4530 uname(1).