File: lsof.8

package info (click to toggle)
lsof 4.74.dfsg.3-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,676 kB
  • ctags: 2,877
  • sloc: ansic: 31,626; sh: 5,848; perl: 1,100; makefile: 607; awk: 214
file content (4082 lines) | stat: -rw-r--r-- 109,376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
.ds VN 4.74
.TH LSOF 8 Revision-\*(VN
.if !\n()P .nr )P 1v
.SH NAME
lsof \- list open files
.SH SYNOPSIS
.B lsof
[
.B \-?abChlnNOPRstUvVX
] [
.BI -A " A"
] [
.BI \-c " c"
] [
.BI +c " c"
] [
.BI +|\-d " d"
] [
.BI +|\-D " D"
] [
.B +|\-f [cfgGn]
] [
.BI \-F " [f]"
] [
.BI \-g " [s]"
] [
.BI \-i " [i]"
] [
.BI \-k " k"
] [
.BI +|\-L " [l]"
] [
.BI +|\-m " m"
] [
.B +|\-M
] [
.BI \-o " [o]"
] [
.BI \-p " s"
] [
.BI +|\-r " [t]"
] [
.BI \-S " [t]"
] [
.BI \-T " [t]"
] [
.BI \-u " s"
] [
.B +|\-w
] [
.BI \-x " [fl]"
] [
.BI \-z " [z]"
] [
.B --
] [\fInames\fP]
.SH DESCRIPTION
.I Lsof
revision \*(VN lists information about files opened by processes for the
following UNIX dialects:
.PP
.nf
	AIX 5.[123]
	Apple Darwin 6.x and 7.x for Power Macintosh systems
	BSDI BSD/OS 4.3.1 for x86-based systems
	DEC OSF/1, Digital UNIX, Tru64 UNIX 4.0, and 5.1
	FreeBSD 4.[2-9], 4.1[01], 5.[012] and 6.0 for x86-based systems
	FreeBSD 5.[012] and 6.0 for Alpha, AMD64 and Sparc64 based systems
	HP-UX 11.00 and 11.11
	Linux 2.1.72 and above for x86-based systems
	NetBSD 1.[456] and 2.x for Alpha, x86, and SPARC-based systems
	NEXTSTEP 3.[13] for NEXTSTEP architectures
	OpenBSD 2.[89] and 3.[0123456] for x86-based systems
	OPENSTEP 4.x
	Caldera OpenUNIX 8
	SCO OpenServer Release 5.0.6 for x86-based systems
	SCO|Caldera UnixWare 7.1.4 for x86-based systems
	Solaris 2.6, 8, 9 and 10
.fi
.PP
(See the
.B DISTRIBUTION
section of this manual page for information on how to obtain the
latest
.I lsof
revision.)
.PP
An open file may be a regular file, a directory, a block special file,
a character special file, an executing text reference, a library,
a stream or a network file (Internet socket, NFS file or UNIX domain socket.)
A specific file or all the files in a file system may be selected by path.
.PP
Instead of a formatted display,
.I lsof
will produce output that can be parsed by other programs.
See the
.BR \-F ,
option description, and the
.B "OUTPUT FOR OTHER PROGRAMS"
section for more information.
.PP
In addition to producing a single output list,
.I lsof
will run in repeat mode.
In repeat mode it will produce output, delay, then repeat the output
operation until stopped with an interrupt or quit signal.
See the
.BI +|\-r " [t]"
option description for more information.
.SH OPTIONS
In the absence of any options,
.I lsof
lists all open files belonging to all active processes.
.PP
If any list request option is specified, other list requests must be
specifically requested \- e.g., if
.B \-U
is specified for the listing of UNIX socket files, NFS files won't be
listed unless
.B \-N
is also specified;
or if a user list is specified with the
.B \-u
option, UNIX domain socket files, belonging to users not in the list,
won't be listed unless the
.B \-U
option is also specified.
.PP
Normally list options that are specifically stated are ORed \- i.e.,
specifying the
.B \-i
option without an address and the \fB\-u\fPfoo option produces a
listing of all network files OR files belonging to processes owned
by user ``foo''.
One exception is the `^' (negated) login name or user ID (UID)
specified with the
.B \-u
option.
Since it is an exclusion, it is applied without ORing or ANDing
and takes effect before any other selection criteria are applied.
.PP
The
.B \-a
option may be used to AND the selections.
For example, specifying
.BR \-a ,
.BR \-U ,
and \fB\-u\fPfoo produces a listing of only UNIX socket files that
belong to processes owned by user ``foo''.
.PP
Caution: the
.B \-a
option causes all list selection options to be ANDed; it can't
be used to cause ANDing of selected pairs of selection options
by placing it between them, even though its placement there is
acceptable.
Wherever
.B \-a
is placed, it causes the ANDing of all selection options.
.PP
Items of the same selection set \- command names, file descriptors,
network addresses, process identifiers, user identifiers, zone names \-
are joined in a single ORed set and applied before the result participates
in ANDing.
Thus, for example, specifying \fB\-i\fP@aaa.bbb, \fB\-i\fP@ccc.ddd,
.BR \-a ,
and \fB\-u\fPfff,ggg will select the listing of files that belong to
either login ``fff'' OR ``ggg'' AND have network connections to either
host aaa.bbb OR ccc.ddd.
.PP
Options may be grouped together following a single prefix -- e.g.,
the option set ``\fB\-a \-b \-C\fP'' may be stated as
.BR \-abC .
However, since values are optional following 
.BR +|\-f ,
.BR \-F ,
.BR \-g ,
.BR \-i ,
.BR +|\-L ,
.BR \-o ,
.BR +|\-r ,
.BR \-S ,
.BR \-T ,
.B \-x
and
.BR \-z .
when you have no values for them be careful that the
following character isn't ambiguous.
For example,
.B \-Fn
might represent the
.B \-F
and
.B \-n
options, or it might represent the
.B n
field identifier character following the
.B \-F
option.
When ambiguity is possible, start a new option with a `-'
character \- e.g., ``\fB\-F \-n\fP''.
If the next option is a file name, follow the possibly ambiguous
option with ``--'' \- e.g., ``\fB\-F -- \fIname\fR''.
.PP
Either the `+' or the `\-' prefix may be applied to a group of options.
Options that don't take on separate meanings for each
prefix \- e.g., \fB\-i\fP \- may be grouped under either prefix.
Thus, for example, ``+M -i'' may be stated as ``+Mi'' and the group
means the same as the separate options.
Be careful of prefix grouping when one or more options in the group
does take on separate meanings under different prefixes \-
e.g., \fB+|\-M\fP; ``-iM'' is not the same request as ``\-i +M''.
When in doubt, use separate options with appropriate prefixes.
.TP \w'names'u+4
.B \-? \-h
These two equivalent options select a usage (help) output list.
.I Lsof
displays a shortened form of this output when it detects an error
in the options supplied to it, after it has displayed messages
explaining each error.
(Escape the `?' character as your shell requires.)
.TP \w'names'u+4
.B \-a
This option causes list selection options to be ANDed, as described
above.
.TP \w'names'u+4
.BI \-A " A"
This option is available on systems configured for AFS whose AFS
kernel code is implemented via dynamic modules.
It allows the
.I lsof
user to specify
.I A
as an alternate name list file where the kernel addresses of the dynamic
modules might be found.
See the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for more information about dynamic modules, their
symbols, and how they affect
.IR lsof .
.TP \w'names'u+4
.B \-b
This option causes
.I lsof
to avoid kernel functions that might block \-
.IR lstat (2),
.IR readlink (2),
and
.IR stat (2).
.IP
See the
.B "BLOCKS AND TIMEOUTS"
and
.B "AVOIDING KERNEL BLOCKS"
sections for information on using this option.
.TP \w'names'u+4
.BI \-c " c"
This option selects the listing of files for processes executing the
command that begins with the characters of
.IR c .
Multiple commands may be specified, using multiple
.B \-c
options.
They are joined in a single ORed set before participating in
AND option selection.
.IP
If
.I c
begins and ends with a slash ('/'), the characters between the slashes
is interpreted as a regular expression.
Shell meta\-characters in the regular expression must be quoted to prevent 
their interpretation by the shell.
The closing slash may be followed by these modifiers:
.IP
.nf
	b	the regular expression is a basic one.
.br
	i	ignore the case of letters.
.br
	x	the regular expression is an extended one
.br
		(default).
.fi
.IP
See the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for more information on basic and extended regular
expressions.
.IP
The simple command specification is tested first.
If that test fails, the command regular expression is applied.
If the simple command test succeeds, the command regular expression
test isn't made.
This may result in ``no command found for regex:'' messages
when lsof's
.B \-V
option is specified.
.TP \w'names'u+4
.BI +c " w"
This option defines the maximum number of initial characters of the name,
supplied by the UNIX dialect, of the UNIX command associated with a process
to be printed in the COMMAND column.
(The
.I lsof
default is nine.)
.IP
Note that many UNIX dialects do not supply all command name characters
to
.I lsof
in the files and structures from which
.I lsof
obtains command name.
Often dialects limit the number of characters supplied in those sources.
For example, Linux 2.4.27 and Solaris 9 both limit command name length to
16 characters.
.IP
If
.I w
is zero ('0'), all command characters supplied to
.I lsof
by the UNIX dialect will be printed.
.IP
If
.I w
is less than the length of the column title, ``COMMAND'', it will
be raised to that length.
.TP \w'names'u+4
.B \-C
This option disables the reporting of any path name
components from the kernel's name cache.
See the
.B "KERNEL NAME CACHE"
section for more information.
.TP \w'names'u+4
.BI +d " s"
This option causes
.I lsof
to search for all open instances of directory
.I s
and the files and directories it contains at its top level.
This option does NOT descend the directory tree, rooted at
.IR s .
The
.BI +D " D"
option may be used to request a full\-descent directory tree search,
rooted at directory
.IR D .
.IP
Processing of the
.B +d
option does not follow symbolic links within
.I s
unless the
.B \-x
or
.B \-x " l"
option is also specified.
Nor does it
search for open files on file system mount points on subdirectories of
.I s
unless the
.B \-x
or
.B \-x " f"
option is also specified.
.IP
Note: the authority of the user of this option limits it to searching for
files that the user has permission to examine with the system
.IR stat (2)
function.
.TP \w'names'u+4
.BI \-d " s"
This option specifies a list of file descriptors (FDs) to exclude from
or include in the output listing.
The file descriptors are specified in the comma\-separated set
.I s
\&\- e.g., ``cwd,1,3'', ``^6,^2''.
(There should be no spaces in the set.)
.IP
The list is an exclusion list if all entries of the set begin with '^'.
It is an inclusion list if no entry begins with '^'.
Mixed lists are not permitted.
.IP
A file descriptor number range may be in the set as long as
neither member is empty, both members are numbers, and the ending
member is larger than the starting one \- e.g., ``0-7'' or ``3-10''.
Ranges may be specified for exclusion if they have the '^' prefix \-
e.g., ``^0-7'' excludes all file descriptors 0 through 7.
.IP
Multiple file descriptor numbers are joined in a single ORed set before
participating in AND option selection.
.IP
When there are exclusion and inclusion members in the set,
.I lsof
reports them as errors and exits with a non\-zero return code.
.IP
See the description of File Descriptor (FD) output values in the
.B OUTPUT
section for more information on file descriptor names.
.TP \w'names'u+4
.BI +D " D"
This option causes
.I lsof
to search for all open instances of directory
.I D
and all the files and directories it contains to its complete depth.
.IP
Processing of the
.B +D
option does not follow symbolic links within
.I D
unless the
.B \-x
or
.B \-x " l"
option is also specified.
Nor does it
search for open files on file system mount points on subdirectories of
.I D
unless the
.B \-x
or
.B \-x " f"
option is also specified.
.IP
Note: the authority of the user of this option limits it to searching for
files that the user has permission to examine with the system
.IR stat (2)
function.
.IP
Further note:
.I lsof
may process this option slowly and require a large amount of dynamic memory
to do it.
This is because it must descend the entire directory tree, rooted at
.IR D ,
calling
.IR stat (2)
for each file and directory, building a list of all the files it finds, and
searching that list for a match with every open file.
When directory
.I D
is large, these steps can take a long time, so use this option prudently.
.TP \w'names'u+4
.BI \-D " D"
This option directs
.I lsof's
use of the device cache file.
The use of this option is sometimes restricted.
See the
.B "DEVICE CACHE FILE"
section and the sections that follow it for more information on this
option.
.IP
.B -D
must be followed by a function letter; the function letter may optionally
be followed by a path name.
.I Lsof
recognizes these function letters:
.IP
.nf
	\fB?\fP \- report device cache file paths
	\fBb\fP \- build the device cache file
	\fBi\fP \- ignore the device cache file
	\fBr\fP \- read the device cache file
	\fBu\fP \- read and update the device cache file
.fi
.IP
The
.BR b ,
.BR r ,
and
.B u
functions, accompanied by a path name, are sometimes restricted.
When these functions are restricted, they will not appear in
the description of the
.B \-D
option that accompanies
.B \-h
or
.B \-?
option output.
See the
.B "DEVICE CACHE FILE"
section and the sections that follow it for more information on these
functions and when they're restricted.
.IP
The
.B ?
function reports the read\-only and write paths that lsof can
use for the device cache file,
the names of any environment variables whose values
.I lsof
will examine when forming the device cache file path,
and the format for the personal device cache file path.
(Escape the `?' character as your shell requires.)
.IP
When available, the
.BR b ,
.BR r ,
and
.B u
functions may be followed by the device cache file's path.
The standard default is
.I .lsof_hostname
in the home directory of the real user ID that executes
.IR lsof ,
but this could have been changed when
.I lsof
was configured and compiled.
(The output of the
.B \-h
and
.B \-?
options show the current default prefix \- e.g., ``.lsof''.)
The suffix,
.IR hostname ,
is the first component of the host's name returned by
.IR gethostname (2) .
.IP
When available, the
.B b
function directs
.I lsof
to build a new device cache file at the default or specified path.
.IP
The
.B i
function directs
.I lsof
to ignore the default device cache file and obtain its information
about devices via direct calls to the kernel.
.IP
The
.B r
function directs
.I lsof
to read the device cache at the default or specified path, but
prevents it from creating a new device cache file when none
exists or the existing one is improperly structured.
The
.B r
function, when specified without a path name, prevents
.I lsof
from updating an incorrect or outdated device cache file,
or creating a new one in its place.
The
.B r
function is always available when it is specified without a
path name argument; it may be restricted by the permissions of the
.I lsof
process.
.IP
When available, the
.B u
function directs
.I lsof
to read the device cache file at the default or specified path,
if possible, and to rebuild it, if necessary.
This is the default device cache file function when no
.B \-D
option has been specified.
.TP \w'names'u+4
.B +|\-f [cfgGn]
.B f
by itself clarifies how path name arguments are to be interpreted.
When followed by
.BR c ,
.BR f ,
.BR g ,
.BR G ,
or
.B n
in any combination it specifies
that the listing of kernel file structure information is to be enabled
(`+') or inhibited (`\-').
.IP
Normally a path name argument is taken to be a file system name if
it matches a mounted\-on directory name reported by
.IR mount (8),
or if it represents a block device, named in the
.I mount
output and associated with a mounted directory name.
When
.B +f
is specified, all path name arguments will be taken to be file
system names, and
.I lsof
will complain if any are not.
This can be useful, for example, when the file system name
(mounted\-on device) isn't a block device.
This happens for some CD-ROM file systems.
.IP
When
.B \-f
is specified by itself, all path name arguments will be taken to be
simple files.
Thus, for example, the ``\fB\-f\fP\ -- /'' arguments direct lsof to search
for open files with a `/' path name, not all open files in the `/'
(root) file system.
.IP
Be careful to make sure
.B +f
and
.B \-f
are properly terminated and aren't followed by a character (e.g., of
the file or file system name) that might be taken as a parameter.
For example, use ``--'' after
.B +f
and
.B \-f
as in these examples.
.IP
.nf
	$ lsof +f -- /file/system/name
	$ lsof -f -- /file/name
.fi
.IP
The listing of information from kernel file structures, requested with the
.B +f [cfgGn]
option form, is normally
inhibited, and is not available for some dialects \- e.g., /proc\-based
Linux.
When the prefix to
.B f
is a plus sign (`+'), these characters request file structure information:
.IP
.nf
	\fBc\fR	file structure use count
	\fBf\fR	file structure address
	\fBg\fR	file flag abbreviations
	\fBG\fR	file flags in hexadecimal
	\fBn\fR	file structure node address
.fi
.IP
When the prefix is minus (`\-') the same characters disable the
listing of the indicated values.
.IP
File structure addresses, use counts, flags, and node addresses may be
used to detect more readily identical files inherited by child
processes and identical files in use by different processes.
.I Lsof
column output can be sorted by output columns holding the values
and listed to identify identical file use, or
.I lsof
field output can be parsed by an AWK or Perl post\-filter script,
or by a C program.
.TP \w'names'u+4
.BI \-F " f"
This option specifies a character list,
.IR f ,
that selects the fields to be output for processing by another program,
and the character that terminates each output field.
Each field to be output is specified with a single character in
.IR f .
The field terminator defaults to NL, but may be changed to NUL (000).
See the
.B "OUTPUT FOR OTHER PROGRAMS"
section for a description of the field identification characters and
the field output process.
.IP
When the field selection character list is empty, all standard fields are
selected (except the raw device field and zone field for compatibility reasons)
and the NL field terminator is used.
.IP
When the field selection character list contains only a zero (`0'),
all fields are selected (except the raw device field for compatibility
reasons) and the NUL terminator character is used.
.IP
Other combinations of fields and their associated field terminator
character must be set with explicit entries in
.IR f ,
as described in the
.B "OUTPUT FOR OTHER PROGRAMS"
section.
.IP
When a field selection character identifies an item
.I lsof
does not normally list \- e.g., PPID, selected with
.BR \-R " \-"
specification of the field character \- e.g., ``\fB\-FR\fP'' \-
also selects the listing of the item.
.IP
When the field selection character list contains the single
character `?',
.I lsof
will display a help list of the field identification characters.
(Escape the `?' character as your shell requires.)
.TP \w'names'u+4
.BI \-g " [s]"
This option selects the listing of files for the processes whose optional
process group IDentification (PGID) numbers are in the comma\-separated
set
.I s
\&\- e.g., ``123'' or ``123,456''.
(There should be no spaces in the set.)
.IP
Multiple PGID numbers are joined in a single ORed set before participating
in AND option selection.
.IP
The
.B \-g
option also enables the output display of PGID numbers.
When specified without a PGID set that's all it does.
.TP \w'names'u+4
.BI \-i " [i]"
This option selects the listing of files any of whose Internet address
matches the address specified in \fIi\fP.
If no address is specified, this option selects the listing of all
Internet and x.25 (HP\-UX) network files.
.IP
If
.BI \-i 4
or
.BI \-i 6
is specified with no following address, only files of the indicated
IP version, IPv4 or IPv6, are displayed.
(An IPv6 specification may be used only if the dialects supports IPv6,
as indicated by ``[46]'' and ``IPv[46]'' in
.I lsof's
.B \-h
or
.B \-?
output.)
Sequentially specifying
.BR \-i 4,
followed by
.BR \-i 6
is the same as specifying
.BR \-i ,
and vice-versa.
Specifying
.BR \-i 4,
or
.BR \-i 6
after
.B \-i
is the same as specifying
.BR \-i 4
or
.BR \-i 6
by itself.
.IP
Multiple addresses (up to a limit of 100) may be specified with multiple
.B \-i
options.
(A port number or service name range is counted as one address.)
They are joined in a single ORed set before participating in
AND option selection.
.IP
An Internet address is specified in the form (Items in square
brackets are optional.):
.IP
[\fI46\fP][\fIprotocol\fP][@\fIhostname\fP\||\|\fIhostaddr\fP][:\fIservice\fP\||\|\fIport\fP]
.IP
where:
.nf
.br
	\fI46\fP specifies the IP version, IPv4 or IPv6
.br
		that applies to the following address.
.br
		'6' may be be specified only if the UNIX
.br
		dialect supports IPv6.  If neither '4' nor
.br
		'6' is specified, the following address
.br
		applies to all IP versions.
.br
	\fIprotocol\fP is a protocol name \- \fBTCP\fP or \fBUDP\fP.
.br
	\fIhostname\fP is an Internet host name.  Unless a
.br
		specific IP version is specified, open
.br
		network files associated with host names
.br
		of all versions will be selected.
.br
	\fIhostaddr\fP is a numeric Internet IPv4 address in
.br
		dot form; or an IPv6 numeric address in
.br
		colon form, enclosed in brackets, if the
.br
		UNIX dialect supports IPv6.  When an IP
.br
		version is selected, only its numeric
.br
		addresses may be specified.
.br
	\fIservice\fP is an \fI/etc/services\fP name \- e.g., \fBsmtp\fP \-
		or a list of them.
.br
	\fIport\fP is a port number, or a list of them.
.fi
.IP
IPv6 options may be used only if the UNIX dialect supports IPv6.
To see if the dialect supports IPv6, run
.I lsof
and specify the
.B \-h
or
.B \-?
(help) option.
If the displayed description of the
.B \-i
option contains ``[46]'' and ``IPv[46]'', IPv6 is supported.
.IP
IPv4 host names and addresses may not be specified if network file selection
is limited to IPv6 with
.BR \-i " 6."
IPv6 host names and addresses may not be specified if network file selection
is limited to IPv4 with
.BR \-i " 4."
When an open IPv4 network file's address is mapped in an IPv6 address,
the open file's type will be IPv6, not IPv4, and its display will be
selected by '6', not '4'.
.IP
At least one address component \-
.BR 4,
.BR 6,
.IR protocol ,
,IR hostname ,
.IR hostaddr ,
or
.I service
\&\- must be supplied.
The `@' character, leading the host specification, is always required;
as is the `:', leading the port specification.
Specify either
.I hostname
or
.IR hostaddr .
Specify either
.I service
name list or
.I port
number list.
If a
.I service
name list is specified, the
.I protocol
may also need to be specified if the TCP and UDP port numbers for
the service name are different.
Use any case \- lower or upper \- for
.IR protocol .
.IP
.I Service
names and
.I port
numbers may be combined in a list whose entries are separated by commas
and whose numeric range entries are separated by minus signs.
There may be no embedded spaces, and all service names must belong to
the specified
.IR protocol .
Since service names may contain embedded minus signs, the staring entry
of a range can't be a service name; it can be a port number, however.
.IP
Here are some sample addresses:
.nf

.br
	-i6 \- IPv6 only
.br
	TCP:25 \- TCP and port 25
.br
	@1.2.3.4 \- Internet IPv4 host address 1.2.3.4
.br
	@[3ffe:1ebc::1]:1234 \- Internet IPv6 host address
		3ffe:1ebc::1, port 1234
.br
	UDP:who \- UDP who service port
.br
	TCP@lsof.itap:513 \- TCP, port 513 and host name lsof.itap
.br
	tcp@foo:1-10,smtp,99 \- TCP, ports 1 through 10,
		service name \fIsmtp\fP, port 99, host name foo
.br
	tcp@bar:smtp-nameserver \- TCP, ports \fIsmtp\fP through
		\fInameserver\fP, host bar
.br
	:time \- either TCP or UDP time service port
.fi
.TP \w'names'u+4
.BI \-k " k"
This option specifies a kernel name list file,
.IR k ,
in place of /vmunix, /mach, etc.
This option is not available under AIX on the IBM RISC/System 6000.
.TP \w'names'u+4
.B \-l
This option inhibits the conversion of user ID numbers to login names.
It is also useful when login name lookup is working improperly or slowly.
.TP \w'names'u+4
.BI +|\-L " [l]"
This option enables (`+') or disables (`-') the listing of file link
counts, where they are available \- e.g., they aren't available
for sockets, or most FIFOs and pipes.
.IP
When
.B +L
is specified without a following number, all link counts will be listed.
When
.B \-L
is specified (the default), no link counts will be listed.
.IP
When
.B +L
is followed by a number, only files having a link count less than
that number will be listed.
(No number may follow
.BR \-L .)
A specification of the form ``\fB+L1\fP'' will select open files that
have been unlinked.
A specification of the form ``\fB+aL1\ \fI<file_system>\fR'' will select
unlinked open files on the specified file system.
.IP
For other link count comparisons, use field output (\fB\-F\fP)
and a post\-processing script or program.
.TP \w'names'u+4
.BI +|\-m " m"
This option specifies an alternate kernel memory file or activates
mount table supplement processing.
.IP
The option form
.BI \-m " m"
specifies a kernel memory file,
.IR m ,
in place of
.I /dev/kmem
or
.I /dev/mem
\&\- e.g., a crash dump file.
.IP
The option form
.B +m
requests that a mount supplement file be written to the standard output
file.
All other options are silently ignored.
.IP
There will be a line in the mount supplement file for each mounted file
system, containing the mounted file system directory, followed by a single
space, followed by the device number in hexadecimal "0x" format \- e.g.,
.IP
.nf
	/ 0x801
.fi
.IP
.I Lsof
can use the mount supplement file to get device numbers for file systems
when it can't get them via
.IR stat (2)
or
.IR lstat (2).
.IP
The option form
.BI +m " m"
identifies
.I m
as a mount supplement file.
.IP
Note: the
.B +m
and
.BI +m " m"
options are not available for all supported dialects.
Check the output of
.I lsof's
.B \-h
or
.B \-?
options to see if the
.B +m
and
.BI +m " m"
options are available.
.TP \w'names'u+4
.B +|\-M
Enables (\fB+\fP) or disables (\fB-\fP) the
reporting of portmapper registrations for local TCP and UDP ports.
The default reporting mode is set by the
.I lsof
builder with the HASPMAPENABLED #define in the dialect's machine.h
header file;
.I lsof
is distributed with the HASPMAPENABLED #define deactivated, so
portmapper reporting is disabled by default and must be requested
with
.BR \+M .
Specifying
.I lsof's
.B \-h
or
.B \-?
option will report the default mode.
Disabling portmapper registration when it is already disabled or
enabling it when already enabled is acceptable.
in a warning.
.IP
When portmapper registration reporting is enabled,
.I lsof
displays the portmapper registration (if any) for local TCP or UDP ports
in square brackets immediately following the port numbers or service
names \- e.g., ``:1234[name]'' or ``:name[100083]''.
The registration information may be a name or number, depending
on what the registering program supplied to the portmapper when
it registered the port.
.IP
When portmapper registration reporting is enabled,
.I lsof
may run a little more slowly or even become blocked when access to the
portmapper becomes congested or stopped.
Reverse the reporting mode to determine if portmapper registration
reporting is slowing or blocking
.IR lsof .
.IP
For purposes of portmapper registration reporting
.I lsof
considers a TCP or UDP port local if: it is found in the local part
of its containing kernel structure;
or if it is located in the foreign part of its containing kernel
structure and the local and foreign Internet addresses are the same;
or if it is located in the foreign part of its containing kernel
structure and the foreign Internet address is INADDR_LOOPBACK (127.0.0.1).
This rule may make
.I lsof
ignore some foreign ports on machines with multiple interfaces
when the foreign Internet address is on a different interface
from the local one.
.IP
See the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for further discussion of portmapper registration
reporting issues.
.TP \w'names'u+4
.B \-n
This option inhibits the conversion of network numbers to 
host names for network files.
Inhibiting conversion may make
.I lsof
run faster.
It is also useful when host name lookup is not working properly.
.TP \w'names'u+4
.B \-N
This option selects the listing of NFS files.
.TP \w'names'u+4
.BI \-o
This option directs
.I lsof
to display file offset at all times.
It causes the SIZE/OFF output column title to be changed to OFFSET.
Note: on some UNIX dialects
.I lsof
can't obtain accurate or consistent file offset information from its
kernel data sources, sometimes just for particular kinds of files
(e.g., socket files.)
Consult the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for more information.
.IP
The
.B \-o
and
.B \-s
options are mutually exclusive; they can't both be specified.
When neither is specified,
.I lsof
displays whatever value \- size or offset \- is appropriate and
available for the type of the file.
.TP \w'names'u+4
.BI \-o " o"
This option defines the number of decimal digits (\fIo\fP) to be
printed after the ``0t'' for a file offset before the form is switched
to ``0x...''.
An
.I o
value of zero (unlimited) directs
.I lsof
to use the ``0t'' form for all offset output.
.IP
This option does NOT direct
.I lsof
to display offset at all times; specify
.B \-o
(without a trailing number) to do that.
This option only specifies the number of digits after ``0t'' in
either mixed size and offset or offset\-only output.
Thus, for example, to direct
.I lsof
to display offset at all times with a decimal digit count of 10, use:
.IP
.nf
	-o -o 10
or
	-oo10
.fi
.IP
The default number of digits allowed after ``0t'' is normally 8,
but may have been changed by the lsof builder.
Consult the description of the
.BI \-o " o"
option in the output of the
.B \-h
or
.B \-?
option to determine the default that is in effect.
.TP \w'names'u+4
.B \-O
This option directs
.I lsof
to bypass the strategy it uses to avoid being blocked by some
kernel operations \- i.e., doing them in forked child processes.
See the
.B "BLOCKS AND TIMEOUTS"
and
.B "AVOIDING KERNEL BLOCKS"
sections for more information on kernel operations that may block
.IR lsof .
.IP
While use of this option will reduce
.I lsof
startup overhead, it may also cause
.I lsof
to hang when the kernel doesn't respond to a function.
Use this option cautiously.
.TP \w'names'u+4
.BI \-p " s"
This option selects the listing of files for the processes whose ID numbers
are in the comma\-separated set
.I s
\&\- e.g., ``123'' or ``123,456''.
(There should be no spaces in the set.)
.IP
Multiple process ID numbers are joined in a single ORed set before
participating in AND option selection.
.TP \w'names'u+4
.B \-P
This option inhibits the conversion of port numbers to port
names for network files.
Inhibiting the conversion may make
.I lsof
run a little faster.
It is also useful when host name lookup is not working properly.
.TP \w'names'u+4
.BI +|\-r " [t]"
This option puts
.I lsof
in repeat mode.
There
.I lsof
lists open files as selected by other options, delays
.I t
seconds (default fifteen), then repeats the listing, delaying
and listing repetitively until stopped by a condition defined by
the prefix to the option.
.IP
If the prefix is a `\-', repeat mode is endless.
.I Lsof
must be terminated with an interrupt or quit signal.
.IP
If the prefix is `+', repeat mode will end the first cycle no open files
are listed \- and of course when
.I lsof
is stopped with an interrupt or quit signal.
When repeat mode ends because no files are listed, the process exit code
will be zero if any open files were ever listed; one, if none were ever
listed.
.IP
.I Lsof
marks the end of each listing:
if field output is in progress (the
.BR \-F ,
option has been specified), the marker is `m'; otherwise the marker
is ``========''.
The marker is followed by a NL character.
.IP
Repeat mode reduces
.I lsof
startup overhead, so it is more efficient to use this mode
than to call
.I lsof
repetitively from a shell script, for example.
.IP
To use repeat mode most efficiently, accompany
.B +|\-r
with specification of other
.I lsof
selection options, so the amount of kernel memory access
.I lsof
does will be kept to a minimum.
Options that filter at the process level \- e.g.,
.BR \-c ,
.BR \-g ,
.BR \-p ,
.B \-u
\&\- are the most efficient selectors.
.IP
Repeat mode is useful when coupled with field output (see the
.BR \-F ,
option description) and a supervising
.I awk
or
.I Perl
script, or a C program.
.TP \w'names'u+4
.B \-R
This option directs lsof to list the Parent Process IDentification
number in the PPID column.
.TP \w'names'u+4
.B \-s
This option directs
.I lsof
to display file size at all times.
It causes the SIZE/OFF output column title to be changed to SIZE.
If the file does not have a size, nothing is displayed.
.IP
The
.B \-o
(without a following decimal digit count) and
.B \-s
options are mutually exclusive; they can't both be specified.
When neither is specified,
.I lsof
displays whatever value \- size or offset \- is appropriate and
available for the type of file.
.IP
Since some types of files don't have true sizes \- sockets, FIFOs,
pipes, etc. \- lsof displays for their sizes the content amounts in
their associated kernel buffers, if possible.
.TP \w'names'u+4
.BI \-S " [t]"
This option specifies an optional time-out seconds value for kernel functions \-
.IR lstat (2),
.IR readlink (2),
and
.IR stat (2)
\- that might otherwise deadlock.
The minimum for
.I t
is two;
the default, fifteen; when no value is specified, the default is used.
.IP
See the
.B "BLOCKS AND TIMEOUTS"
section for more information.
.TP \w'names'u+4
.BI \-T " [t]"
This option controls the reporting of some TCP/TPI information, also
reported by
.IR netstat (1),
following the network addresses.
In normal output the information appears in parentheses, each item
except state identified by a keyword, followed by `=', separated from
others by a single space:
.IP
.nf
	<TCP or TPI state name>
	QR=<read queue length>
	QS=<send queue length>
	SO=<socket options and values>
	SS=<socket states>
	TF=<TCP flags and values>
	WR=<window read length>
	WW=<window write length>
.fi
.IP
Not all values are reported for all UNIX dialects.
Items values (when available) are reported after the item name and '='.
.IP
When the field output mode is in effect (See
.BR "OUTPUT FOR OTHER PROGRAMS" .)
each item appears as a field with a `T' leading character.
.IP
.B \-T
with no following key characters disables TCP/TPI information reporting.
.IP
.B \-T
with following characters selects the reporting of specific TCP/TPI
information:
.IP
.nf
	\fBf\fP	selects reporting of socket options,
		states and values, and TCP flags and
		values.
	\fBq\fP	selects queue length reporting.
	\fBs\fP	selects connection state reporting.
	\fBw\fP	selects window size reporting.
.fi
.IP
Not all selections are enabled for some UNIX dialects.
State may be selected for all dialects and is reported by default.
The
.B \-h
or
.B \-?
help output for the
.B \-T
option will show what selections may be used with the UNIX dialect.
.IP
When
.B \-T
is used to select information \- i.e., it is followed by one or more
selection characters \- the displaying of state is disabled by default,
and it must be explicitly selected again in the characters following
.BR \-T .
(In effect, then, the default is equivalent to
.BR -Ts .)
For example, if queue lengths and state are desired, use
.BR \-Tqs .
.IP
Socket options, socket states, some socket values, TCP flags and
one TCP value may be reported (when available in the UNIX dialect)
in the form of the names that commonly appear after SO_, so_, SS_,
TCP_  and TF_ in the dialect's header files \-
most often <sys/socket.h>, <sys/socketvar.h> and <netinet/tcp_var.h>.
Consult those header files for the meaning of the flags, options,
states and values.
.IP
``SO='' precedes socket options and values; ``SS='', socket states;
and ``TF='', TCP flags and values.
.IP
If a flag or option has a value, the value will follow an '=' and
the name -- e.g., ``SO=LINGER=5'', ``SO=QLIM=5'', ``TF=MSS=512''.
The following seven values may be reported:
.IP
.nf
	Name
	Reported	Description (Common Symbol)

	KEEPALIVE	keep alive time (SO_KEEPALIVE)
	LINGER	linger time (SO_LINGER)
	MSS		maximum segment size (TCP_MAXSEG)
	QLEN		listen queue length
	QLIM		listen queue limit
	RCVBUF	receive buffer length (SO_RCVBUF)
	SNDBUF	send buffer length (SO_SNDBUF)
.fi
.IP
Details on what socket options and values, socket states, and TCP flags
and values may be displayed for particular UNIX dialects may be found in
the answer to the ``Why doesn't lsof report socket options, socket states,
and TCP flags and values for my dialect?''
question in the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
.TP \w'names'u+4
.B \-t 
This option specifies that
.I lsof
should produce terse output with process identifiers only and no header \-
e.g., so that the output may be piped to
.IR kill (1).
This option selects the
.B \-w
option.
.TP \w'names'u+4
.BI \-u " s"
This option selects the listing of files for the user whose login names
or user ID numbers are in the comma\-separated set
.I s
\&\- e.g., ``abe'',
or ``548,root''.
(There should be no spaces in the set.)
.IP
Multiple login names or user ID numbers are joined in a single ORed set
before participating in AND option selection.
.IP
If a login name or user ID is preceded by a `^', it becomes a negation \-
i.e., files of processes owned by the login name or user ID will never
be listed.
A negated login name or user ID selection is neither ANDed nor ORed
with other selections; it is applied before all other selections and
absolutely excludes the listing of the files of the process.
For example, to direct
.I lsof
to exclude the listing of files belonging to root processes,
specify ``\-u^root'' or ``\-u^0''.
.TP \w'names'u+4
.B \-U
This option selects the listing of UNIX domain socket files.
.TP \w'names'u+4
.B \-v
This option selects the listing of
.I lsof
version information, including: revision number;
when the
.I lsof
binary was constructed;
who constructed the binary and where;
the name of the compiler used to construct the
.I lsof binary;
the version number of the compiler when readily available;
the compiler and loader flags used to construct the
.I lsof
binary;
and system information, typically the output of
.IR uname 's
.B \-a
option.
.TP \w'names'u+4
.B \-V
This option directs
.I lsof
to indicate the items it was asked to list and failed to find \- command
names, file names, Internet addresses or files, login names, NFS files,
PIDs, PGIDs, and UIDs.
.IP
When other options are ANDed to search options, or compile\-time
options restrict the listing of some files,
.I lsof
may not report that it failed to find a search item when an ANDed
option or compile\-time option prevents the listing of the open file
containing the located search item.
.IP
For example, ``lsof -V -iTCP@foobar -a -d 999'' may not report a
failure to locate open files at ``TCP@foobar'' and may not list
any, if none have a file descriptor number of 999.
A similar situtation arises when HASSECURITY and HASNOSOCKSECURITY are
defined at compile time and they prevent the listing of open files.
.TP \w'names'u+4
.B +|\-w
Enables (\fB+\fP) or disables (\fB-\fP) the suppression of warning messages.
.IP
The
.I lsof
builder may choose to have warning messages disabled or enabled by
default.
The default warning message state is indicated in the output of the
.B \-h
or
.B \-?
option.
Disabling warning messages when they are already disabled or enabling
them when already enabled is acceptable.
.IP
The
.B \-t
option selects the
.B \-w
option.
.TP \w'names'u+4
.B \-x " [fl]"
This option may accompany the
.B +d
and
.B +D
options to direct their processing to cross over symbolic links
and|or file system mount points encountered when scanning the
directory (\fB+d\fP) or directory tree (\fB+D\fP).
.IP
If
.B -x
is specified by itself without a following parameter, cross\-over
processing of both symbolic links and file system mount points is
enabled.
Note that when
.B \-x
is specified without a parameter, the next argument must begin with '-'
or '+'.
.IP
The optional 'f' parameter enables file system mount point cross\-over
processing; 'l', symbolic link cross\-over processing.
.IP
The
.B \-x
option may not be supplied without also supplying a
.B +d
or
.B +D
option.
.TP \w'names'u+4
.B \-X
This is a dialect\-specific option.
.HP \w'names'u+4
\ \ \ \ AIX:
.br
This IBM AIX RISC/System 6000 option requests the reporting
of executed text file and shared library references.
.IP
.B WARNING:
because this option uses the kernel readx() function, its use on
a busy AIX system might cause an application process to hang so
completely that it can neither be killed nor stopped.
I have never seen this happen or had a report of its happening,
but I think there is a remote possibility it could happen.
.IP
By default use of readx() is disabled.
On AIX 5L and above
.I lsof
may need setuid\-root permission to perform the actions this
option requests.
.IP
The
.I lsof
builder may specify that the
.B \-X
option be restricted to processes whose real UID is root.
If that has been done, the
.B \-X
option will not appear in the
.B \-h
or
.B \-?
help output unless the real UID of the
.I lsof
process is root.
The default
.I lsof
distribution allows any UID to specify
.BR \-X,
so by default it will appear in the help output.
.IP
When AIX readx() use
is disabled,
.I lsof
may not be able to report information for all text and loader file
references, but it may also avoid exacerbating an AIX
kernel directory search kernel error, known as the Stale Segment
ID bug.
.IP
The readx() function, used by
.I lsof
or any other program to access some sections of kernel virtual
memory, can trigger the Stale Segment ID bug.
It can cause the kernel's dir_search() function to believe erroneously
that part of an in\-memory copy of a file system directory has been
zeroed.
Another application process, distinct from
.IR lsof ,
asking the kernel to search the directory \- e.g., by using
.IR open "(2) \-"
can cause dir_search() to loop forever, thus hanging the application process.
.IP
Consult the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
and the
.I 00README
file of the
.I lsof
distribution for a more complete description of the Stale Segment ID bug,
its APAR, and methods for defining readx() use when compiling
.IR lsof .
.TP \w'names'u+4
.BI \-z " [z]"
specifies how Solaris 10 and higher zone information is to be handled.
.IP
Without a following argument \- e.g., NO
.IR z " \-"
the option specifies that zone names are to be listed in the ZONE
output column.
.IP
The
.B \-z
option may be followed by a zone name,
.BI z .
That causes lsof to list only open files for processes in that zone.
Multiple
.BI \-z " z"
option and argument pairs may be specified to form a list of named zones.
Any open file of any process in any of the zones will be listed, subject
to other conditions specified by other options and arguments.
.TP \w'names'u+4
.B --
The double minus sign option is a marker that signals the end of
the keyed options.
It may be used, for example, when the first file name begins with
a minus sign.
It may also be used when the absence of a value for the last keyed
option must be signified by the presence of a minus sign in the following
option and before the start of the file names.
.TP \w'names'u+4
.I names
These are path names of specific files to list.
Symbolic links are resolved before use.
The first name may be separated from the preceding options with
the ``--'' option.
.IP
If a
.I name 
is the mounted\-on directory of a file system or the device of the
file system,
.I lsof
will list all the files open on the file system.
To be considered a file system, the
.I name
must match a mounted\-on directory name in
.IR mount (8)
output, or match the name of a block device associated with a mounted\-on
directory name.
The
.B +|\-f
option may be used to force
.I lsof
to consider a
.I name
a file system identifier (\fB+f\fP) or a simple file (\fB\-f\fP).
.IP
If
.I name
is a path to a directory that is not the mounted\-on directory name of
a file system, it is treated just as a regular file is treated \- i.e.,
its listing is restricted to processes that have it open as a file or
as a process\-specific directory, such as the root or current working
directory.
To request that
.I lsof
look for open files inside a directory name, use the
.BI +d " s"
and
.BI +D " D"
options.
.IP
If a
.I name
is the base name of a family of multiplexed files \- e. g, AIX's
.IR /dev/pt[cs] " \-"
.I lsof
will list all the associated multipled files on the device that
are open \- e.g.,
.IR /dev/pt[cs]/1 ,
.IR /dev/pt[cs]/2 ,
etc.
.IP
If a
.I name
is a UNIX domain socket name,
.I lsof
will usually search for it by the characters of the name alone \- exactly as
it is specified and is recorded in the kernel socket structure.
(See the next paragraph for an exception to that rule for Linux.)
Specifying a relative path \- e.g.,
.I ./file
\&\- in place of the
file's absolute path \- e.g.,
.I /tmp/file
\&\- won't work because
.I lsof
must match the characters you specify with what it finds in the
kernel UNIX domain socket structures.
.IP
If a
.I name
is a Linux UNIX domain socket name, in one case
.I lsof
is able to search for it by its device and inode number, allowing
.I name
to be a relative path.
The case requires that the absolute path -- i.e., one beginning with a
slash ('/') be used by the process that created the socket, and hence be
stored in the
.I /proc/net/unix
file; and it requires that
.I lsof
be able to obtain the device and node numbers of both the absolute path in
.I /proc/net/unix
and
.I name
via successful
.IR stat (2)
system calls.
When those conditions are met,
.I lsof
will be able to search for the UNIX domain socket when some path to it is
is specified in
.IR name .
Thus, for example, if the path is
.IR /dev/log ,
and an
.I lsof
search is initiated when the working directory is
.IR /dev ,
then
.I name
could be
.IR ./log .
.IP
If a
.I name
is none of the above,
.I lsof
will list any open files whose device and inode match that of the
specified path
.IR name .
.IP
If you have also specified the
.B \-b
option,
the only
.I names
you may safely specify are file systems for which your mount table
supplies alternate device numbers.
See the
.B "AVOIDING KERNEL BLOCKS"
and
.B "ALTERNATE DEVICE NUMBERS"
sections for more information.
.IP
Multiple file names are joined in a single ORed set before
participating in AND option selection.
.SH AFS
.I Lsof
supports the recognition of AFS files for these dialects (and AFS
versions):
.PP
.nf
	AIX 4.1.4 (AFS 3.4a)
	HP\-UX 9.0.5 (AFS 3.4a)
	Linux 1.2.13 (AFS 3.3)
	Solaris 2.[56] (AFS 3.4a)
.fi
.PP
It may recognize AFS files on other versions of these dialects,
but has not been tested there.
Depending on how AFS is implemented,
.I lsof
may recognize AFS files in other dialects, or may have difficulties
recognizing AFS files in the supported dialects.
.PP
.I Lsof
may have trouble identifying all aspects of AFS files in
supported dialects when AFS kernel support is implemented via
dynamic modules whose addresses do not appear in the kernel's
variable name list.
In that case,
.I lsof
may have to guess at the identity of AFS files, and might not be able to
obtain volume information from the kernel that is needed for calculating
AFS volume node numbers.
When
.I lsof
can't compute volume node numbers, it reports blank in the NODE column.
.PP
The
.BI \-A " A"
option is available in some dialect implementations of
.I lsof
for specifying the name list file where dynamic module kernel
addresses may be found.
When this option is available, it will be listed in the
.I lsof
help output, presented in response to the
.B \-h
or
.B \-?
.PP
See the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for more information about dynamic modules, their
symbols, and how they affect
.I lsof
options.
.PP
Because AFS path lookups don't seem to participate in the
kernel's name cache operations,
.I lsof
can't identify path name components for AFS files.
.SH SECURITY
.I Lsof
has three features that may cause security concerns.
First, its default compilation mode allows anyone to list all
open files with it.
Second, by default it creates a user\-readable and user\-writable device
cache file in the home directory of the real user ID that executes
.IR lsof .
(The list\-all\-open\-files and device cache features may be disabled when
.I lsof
is compiled.)
Third, its
.B \-k
and
.B \-m
options name alternate kernel name list or memory files.
.PP
Restricting the listing of all open files is controlled by the
compile\-time HASSECURITY and HASNOSOCKSECURITY options.
When HASSECURITY is defined,
.I lsof
will allow only the root user to list all open files.
The non\-root user may list only open files of processes with the same user
IDentification number as the real user ID number of the
.I lsof
process (the one that its user logged on with).
.PP
However, if HASSECURITY and HASNOSOCKSECURITY are both defined,
anyone may list open socket files, provided they are selected
with the
.B \-i
option.
.PP
When HASSECURITY is not defined, anyone may list all open files.
.PP
Help output, presented in response to the
.B \-h
or
.B \-?
option, gives the status of the HASSECURITY and HASNOSOCKSECURITY definitions.
.PP
See the
.B Security
section of the
.I 0README
file of the
.I lsof
distribution for information on building
.I lsof
with the HASSECURITY and HASNOSOCKSECURITY options enabled.
.PP
Creation and use of a user\-readable and user\-writable device
cache file is controlled by the compile\-time HASDCACHE option.
See the
.B "DEVICE CACHE FILE"
section and the sections that follow it for details on how its path
is formed.
For security considerations it is important to note that in the default
.I lsof
distribution, if the real user ID under which
.I lsof
is executed is root, the device cache file will be written in root's
home directory \- e.g.,
.I /
or
.IR /root .
When HASDCACHE is not defined,
.I lsof
does not write or attempt to read a device cache file.
.PP
When HASDCACHE is defined, the
.I lsof
help output, presented in response to the
.BR \-h ,
.BR \-D? ,
or
.B \-?
options, will provide device cache file handling information.
When HASDCACHE is not defined, the
.B \-h
or
.B \-?
output will have no
.B \-D
option description.
.PP
Before you decide to disable the device cache file feature \- enabling
it improves the performance of
.I lsof
by reducing the startup overhead of examining all the nodes in
.I /dev
(or
.IR /devices )
\&\- read the discussion of it in the
.I 00DCACHE
file of the
.I lsof
distribution and the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
.PP
WHEN IN DOUBT, YOU CAN TEMPORARILY DISABLE THE USE OF THE DEVICE CACHE FILE
WITH THE
.B \-Di
OPTION.
.PP
When
.I lsof
user declares alternate kernel name list or memory files with the
.B \-k
and
.B \-m
options,
.I lsof
checks the user's authority to read them with
.IR access (2).
This is intended to prevent whatever special power
.I lsof's
modes might confer on it from letting it read files not normally
accessible via the authority of the real user ID.
.SH OUTPUT
This section describes the information
.I lsof
lists for each open file.
See the
.B "OUTPUT FOR OTHER PROGRAMS"
section for additional information on output that can be processed
by another program.
.PP
.I Lsof
only outputs printable (declared so by
.IR isprint (3))
8 bit characters.
Non\-printable characters are printed in one of three forms:
the C ``\\[bfrnt]'' form;
the control character `^' form (e.g., ``^@'');
or hexadecimal leading ``\\x'' form (e.g., ``\\xab'').
Space is non\-printable in the COMMAND column (``\\x20'')
and printable elsewhere.
.PP
For some dialects \- if HASSETLOCALE is defined in the dialect's
machine.h header file \-
.I lsof
will print the extended 8 bit characters of a language locale.
The
.I lsof
process must be supplied a language locale environment variable
(e.g., LANG) whose value represents a known language locale
in which the extended characters are considered printable by
.IR isprint (3).
Otherwise
.I lsof
considers the extended characters non\-printable and prints them according
to its rules for non\-printable characters, stated above.
Consult your dialect's
.IR setlocale (3)
man page for the names of other environment variables that may
be used in place of LANG \- e.g., LC_ALL, LC_CTYPE, etc.
.PP
.I Lsof's
language locale support for a dialect also covers wide characters \- e.g.,
UTF-8 \- when HASSETLOCALE and HASWIDECHAR are defined in the dialect's
machine.h header file, and when a suitable language locale has been defined
in the appropriate environment variable for the
.I lsof
process.
Wide characters are printable under those conditions if
.IR iswprint (3)
reports them to be.
If HASSETLOCALE, HASWIDECHAR and a suitable language locale aren't defined,
or if
.IR iswprint (3)
reports wide characters that aren't printable,
.I lsof
considers the wide characters non\-printable and prints each of their
8 bits according to its rules for non\-printable characters, stated above.
.PP
Consult the answers to the "Language locale support" questions in the
lsof FAQ (The \fBFAQ\fP section gives its location.) for more information.
.PP
.I Lsof
dynamically sizes the output columns each time it runs, guaranteeing
that each column is a minimum size.
It also guarantees that each column is separated from its predecessor
by at least one space.
.TP \w'COMMAND'u+4
COMMAND
contains the first nine characters of the name of the UNIX command
associated with the process.
If a non\-zero
.I w
value is specified to the
.BI +c " w"
option, the column contains the first
.I w
characters of the name of the UNIX command associated with the process
up to the limit of characters supplied to
.I lsof
by the UNIX dialect.
(See the description of the
.BI +c " w"
command or the
.I lsof
FAQ for more information.
The \fBFAQ\fP section gives its location.)
.IP
If
.I w
is less than the length of the column title, ``COMMAND'', it will
be raised to that length.
.IP
If a zero
.I w
value is specified to the
.BI +c " w"
option, the column contains all the characters of the name of the UNIX command
associated with the process.
.IP
All command name characters maintained by the kernel in its structures
are displayed in field output when the command name descriptor (`c')
is specified.
See the
.B "OUTPUT FOR OTHER COMMANDS"
section for information on selecting field output and the associated
command name descriptor.
.TP
PID
is the Process IDentification number of the process.
.TP
ZONE
is the Solaris 10 and higher zone name.
This column must be selected with the
.B \-z
option.
.TP
PPID
is the Parent Process IDentification number of the process.
It is only displayed when the
.B \-R
option has been specified.
.TP
PGID
is the process group IDentification number associated with
the process.
It is only displayed when the
.B \-g
option has been specified.
.TP
USER
is the user ID number or login name of the user to whom
the process belongs, usually the same as reported by
.IR ps (1).
However, on Linux USER is the user ID number or login that owns
the directory in /proc where
.I lsof
finds information about the process.
Usually that is the same value reported by
.IR ps (1),
but may differ when the process has changed its effective user ID.
(See the
.B \-l
option description for information on when a user ID number or
login name is displayed.)
.TP
FD
is the File Descriptor number of the file or:
.IP
.nf
	\fBcwd\fP	current working directory;
.br
	\fBL\fInn\fR	library references (AIX);
.br
	\fBjld\fR	jail directory (FreeBSD);
.br
	\fBltx\fP	shared library text (code and data);
.br
	\fBMxx\fP	hex memory\-mapped type number xx.
.br
	\fBm86\fP	DOS Merge mapped file;
.br
	\fBmem\fP	memory\-mapped file;
.br
	\fBmmap\fP	memory\-mapped device;
.br
	\fBpd\fP	parent directory;
.br
	\fBrtd\fP	root directory;
.br
	\fBtr\fR	kernel trace file (OpenBSD);
.br
	\fBtxt\fP	program text (code and data);
.br
	\fBv86\fP	VP/ix mapped file;
.fi
.IP
FD is followed by one of these characters, describing the mode under which
the file is open:
.IP
	\fBr\fP for read access;
.br
	\fBw\fP for write access;
.br
	\fBu\fP for read and write access;
.br
	space if mode unknown and no lock
.br
		character follows;
.br
	`\-' if mode unknown and lock
.br
		character follows.
.IP
The mode character is followed by one of these lock characters, describing
the type of lock applied to the file:
.IP
	\fBN\fP for a Solaris NFS lock of unknown type;
.br
	\fBr\fP for read lock on part of the file;
.br
	\fBR\fP for a read lock on the entire file;
.br
	\fBw\fP for a write lock on part of the file;
.br
	\fBW\fP for a write lock on the entire file;
.br
	\fBu\fP for a read and write lock of any length;
.br
	\fBU\fP for a lock of unknown type;
.br
	\fBx\fP for an SCO OpenServer Xenix lock on part
	of the file;
.br
	\fBX\fP for an SCO OpenServer Xenix lock on the
	entire file;
.br
	space if there is no lock.
.IP
See the
.B LOCKS
section for more information on the lock information character.
.IP
The FD column contents constitutes a single field for parsing in
post\-processing scripts.
.TP
TYPE
is the type of the node associated with the file \- e.g., GDIR, GREG,
VDIR, VREG, etc.
.IP
or ``IPv4'' for an IPv4 socket;
.IP
or ``IPv6'' for an open IPv6 network file \- even if its address is
IPv4, mapped in an IPv6 address;
.IP
or ``ax25'' for a Linux AX.25 socket;
.IP
or ``inet'' for an Internet domain socket;
.IP
or ``lla'' for a HP\-UX link level access file;
.IP
or ``rte'' for an AF_ROUTE socket;
.IP
or ``sock'' for a socket of unknown domain;
.IP
or ``unix'' for a UNIX domain socket;
.IP
or ``x.25'' for an HP\-UX x.25 socket;
.IP
or ``BLK'' for a block special file;
.IP
or ``CHR'' for a character special file;
.IP
or ``DEL'' for a Linux map file that has been deleted;
.IP
or ``DIR'' for a directory;
.IP
or ``DOOR'' for a VDOOR file;
.IP
or ``FIFO'' for a FIFO special file;
.IP
or ``KQUEUE'' for a BSD style kernel event queue file;
.IP
or ``LINK'' for a symbolic link file;
.IP
or ``MPB'' for a multiplexed block file;
.IP
or ``MPC'' for a multiplexed character file;
.IP
or ``NOFD'' for a Linux /proc/<PID>/fd directory that can't be opened \--
the directory path appears in the NAME column, followed by an error
message;
.IP
or ``PAS'' for a
.I /proc/as
file;
.IP
or ``PAXV'' for a
.I /proc/auxv
file;
.IP
or ``PCRE'' for a
.I /proc/cred
file;
.IP
or ``PCTL'' for a
.I /proc
control file;
.IP
or ``PCUR'' for the current
.I /proc
process;
.IP
or ``PCWD'' for a
.I /proc
current working directory;
.IP
or ``PDIR'' for a
.I /proc
directory;
.IP
or ``PETY'' for a
.I /proc
executable type (\fIetype\fP);
.IP
or ``PFD'' for a
.I /proc
file descriptor;
.IP
or ``PFDR'' for a
.I /proc
file descriptor directory;
.IP
or ``PFIL'' for an executable
.I /proc
file;
.IP
or ``PFPR'' for a
.I /proc
FP register set;
.IP
or ``PGD'' for a
.I /proc/pagedata
file;
.IP
or ``PGID'' for a
.I /proc
group notifier file;
.IP
or ``PIPE'' for pipes;
.IP
or ``PLC'' for a
.I /proc/lwpctl
file;
.IP
or ``PLDR'' for a
.I /proc/lpw
directory;
.IP
or ``PLDT'' for a
.I /proc/ldt
file;
.IP
or ``PLPI'' for a
.I /proc/lpsinfo
file;
.IP
or ``PLST'' for a
.I /proc/lstatus
file;
.IP
or ``PLU'' for a
.I /proc/lusage
file;
.IP
or ``PLWG'' for a
.I /proc/gwindows
file;
.IP
or ``PLWI'' for a
.I /proc/lwpsinfo
file;
.IP
or ``PLWS'' for a
.I /proc/lwpstatus
file;
.IP
or ``PLWU'' for a
.I /proc/lwpusage
file;
.IP
or ``PLWX'' for a
.I /proc/xregs
file'
.IP
or ``PMAP'' for a
.I /proc
map file (\fImap\fP);
.IP
or ``PMEM'' for a
.I /proc
memory image file;
.IP
or ``PNTF'' for a
.I /proc
process notifier file;
.IP
or ``POBJ'' for a
.I /proc/object
file;
.IP
or ``PODR'' for a
.I /proc/object
directory;
.IP
or ``POLP'' for an old format
.I /proc
light weight process file;
.IP
or ``POPF'' for an old format
.I /proc
PID file;
.IP
or ``POPG'' for an old format
.I /proc
page data file;
.IP
or ``PORT'' for a SYSV named pipe;
.IP
or ``PREG'' for a
.I /proc
register file;
.IP
or ``PRMP'' for a
.I /proc/rmap
file;
.IP
or ``PRTD'' for a
.I /proc
root directory;
.IP
or ``PSGA'' for a
.I /proc/sigact
file;
.IP
or ``PSIN'' for a
.I /proc/psinfo
file;
.IP
or ``PSTA'' for a
.I /proc
status file;
.IP
or ``PSXSEM'' for a POSIX sempahore file;
.IP
or ``PSXSHM'' for a POSIX shared memory file;
.IP
or ``PUSG'' for a
.I /proc/usage
file;
.IP
or ``PW'' for a
.I /proc/watch
file;
.IP
or ``PXMP'' for a
.I /proc/xmap
file;
.IP
or ``REG'' for a regular file;
.IP
or ``SMT'' for a shared memory transport file;
.IP
or ``STSO'' for a stream socket;
.IP
or ``UNNM'' for an unnamed type file;
.IP
or ``XNAM'' for an OpenServer Xenix special file of unknown type;
.IP
or ``XSEM'' for an OpenServer Xenix semaphore file;
.IP
or ``XSD'' for an OpenServer Xenix shared data file.
.TP
FILE\-ADDR
contains the kernel file structure address when
.B f
has been specified to
.BR +f ;
.TP
FCT
contains the file reference count from the kernel file structure when
.B c
has been specified to
.BR +f ;
.TP
FILE\-FLAG
when
.B g
or
.B G
has been specified to
.BR +f ,
this field contains the contents of the f_flag[s] member of the kernel
file structure and the kernel's per\-process open file flags (if available);
\&`G' causes them to be displayed in hexadecimal;
\&`g', as short\-hand names;
two lists may be displayed with entries separated by commas, the
lists separated by a semicolon (`;');
the first list may contain short\-hand names for f_flag[s] values from
the following table:
.IP
.nf
	AIO		asynchronous I/O (e.g., FAIO)
	AP		append
	ASYN		asynchronous I/O (e.g., FASYNC)
	BAS		block, test, and set in use
	BKIU		block if in use
	BL		use block offsets
	BSK		block seek
	CA		copy avoid
	CIO		concurrent I/O
	CLON		clone
	CLRD		CL read
	CR		create
	DF		defer
	DFI		defer IND
	DFLU		data flush
	DIR		direct
	DLY		delay
	DOCL		do clone
	DSYN		data\-only integrity
	EX		open for exec
	EXCL		exclusive open
	FSYN		synchronous writes
	GCDF		defer during unp_gc() (AIX)
	GCMK		mark during unp_gc() (AIX)
	GTTY		accessed via /dev/tty
	HUP		HUP in progress
	KERN		kernel
	KIOC		kernel\-issued ioctl
	LCK		has lock
	LG		large file
	MBLK		stream message block
	MK		mark
	MNT		mount
	MSYN		multiplex synchronization
	NB		non\-blocking I/O
	NBDR		no BDRM check
	NBIO		SYSV non\-blocking I/O
	NBF		n\-buffering in effect
	NC		no cache
	ND		no delay
	NDSY		no data synchronization
	NET		network
	NMFS		NM file system
	NOTO		disable background stop
	NSH		no share
	NTTY		no controlling TTY
	OLRM		OLR mirror
	PAIO		POSIX asynchronous I/O
	PP		POSIX pipe
	R		read
	RC		file and record locking cache
	REV		revoked
	RSH		shared read
	RSYN		read synchronization
	SL		shared lock
	SNAP		cooked snapshot
	SOCK		socket
	SQSH		Sequent shared set on open
	SQSV		Sequent SVM set on open
	SQR		Sequent set repair on open
	SQS1		Sequent full shared open
	SQS2		Sequent partial shared open
	STPI		stop I/O
	SWR		synchronous read
	SYN		file integrity while writing
	TCPM		avoid TCP collision
	TR		truncate
	W		write
	WKUP		parallel I/O synchronization
	WTG		parallel I/O synchronization
	VH		vhangup pending
	VTXT		virtual text
	XL		exclusive lock
.fi
.IP
this list of names was derived from F* #define's in dialect header files
<fcntl.h>, <linux</fs.h>, <sys/fcntl.c>, <sys/fcntlcom.h>, and <sys/file.h>;
see the lsof.h header file for a list showing the correspondence
between the above short\-hand names and the header file definitions;
.IP
the second list (after the semicolon) may contain short\-hand names
for kernel per\-process open file flags from this table:
.IP
.nf
	ALLC		allocated
	BR		the file has been read
	BHUP		activity stopped by SIGHUP
	BW		the file has been written
	CLSG		closing
	CX		close\-on-exec (see fcntl(F_SETFD))
	MP		memory\-mapped
	LCK		lock was applied
	RSVW		reserved wait
	SHMT		UF_FSHMAT set (AIX)
	USE		in use (multi\-threaded)
.fi
.TP
NODE\-ID
(or INODE\-ADDR for some dialects)
contains a unique identifier for the file node (usually the kernel
vnode or inode address, but also occasionally a concatenation of
device and node number) when
.B n
has been specified to
.BR +f ;
.TP
DEVICE
contains the device numbers, separated by commas, for a character special,
block special, regular, directory or NFS file;
.IP
or ``memory'' for a memory file system node under DEC OSF/1, Digital
UNIX, or Tru64 UNIX;
.IP
or the address of the private data area of a Solaris socket
stream;
.IP
or a kernel reference address that identifies the file
(The kernel reference address may be used for FIFO's, for example.);
.IP
or
the base address or device name of a Linux AX.25 socket device.
.IP
Usually only the lower thirty two bits of DEC OSF/1, Digital UNIX,
or Tru64 UNIX kernel addresses are displayed.
.TP
SIZE, SIZE/OFF, or OFFSET
is the size of the file or the file offset in bytes.
A value is displayed in this column only if it is available.
.I Lsof
displays whatever value \- size or offset \- is appropriate for the type
of the file and the version of
.IR lsof .
.IP
On some UNIX dialects
.I lsof
can't obtain accurate or consistent file offset information from its
kernel data sources, sometimes just for particular kinds of files
(e.g., socket files.)
In other cases, files don't have true sizes \- e.g., sockets, FIFOs,
pipes \- so
.I lsof
displays for their sizes the content amounts it finds in their kernel
buffer descriptors (e.g., socket buffer size counts or TCP/IP window
sizes.)
Consult the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for more information.
.IP
The file size is displayed in decimal;
the offset is normally displayed in decimal with a leading ``0t'' if
it contains 8 digits or less; in hexadecimal with a leading ``0x'' if
it is longer than 8 digits.
(Consult the
.BI \-o " o"
option description for information on when 8 might default to
some other value.)
.IP
Thus the leading ``0t'' and ``0x'' identify an offset when the column
may contain both a size and an offset (i.e., its title is SIZE/OFF).
.IP
If the
.B \-o
option is specified,
.I lsof
always displays the file offset (or nothing if no offset is available)
and labels the column OFFSET.
The offset always begins with ``0t'' or ``0x'' as described above.
.IP
The
.I lsof
user can control the switch from ``0t'' to ``0x'' with the
.BI \-o " o"
option.
Consult its description for more information.
.IP
If the
.B \-s
option is specified,
.I lsof
always displays the file size (or nothing if no size is available)
and labels the column SIZE.
The
.B \-o
and
.B \-s
options are mutually exclusive; they can't both be specified.
.IP
For files that don't have a fixed size \- e.g., don't reside
on a disk device \-
.I lsof
will display appropriate information about the current size or
position of the file if it is available in the kernel structures
that define the file.
.TP
NODE
is the node number of a local file;
.IP
or the inode number of an NFS file in the server host;
.IP
or the Internet protocol type \- e. g, ``TCP'';
.IP
or ``STR'' for a stream;
.IP
or ``CCITT'' for an HP\-UX x.25 socket;
.IP
or the IRQ or inode number of a Linux AX.25 socket device.
.TP
NAME
is the name of the mount point and file system on which the file resides;
.IP
or the name of a file specified in the
.I names
option (after any symbolic links have been resolved);
.IP
or the name of a character special or block special device;
.IP
or the local and remote Internet addresses of a network file;
the local host name or IP number is followed by a colon (':'), the
port, ``->'', and the two\-part remote address;
IP addresses may be reported as numbers or names, depending on the
.BR +|\-M ,
.BR \-n ,
and
.B \-P
options;
colon\-separated IPv6 numbers are enclosed in square brackets;
IPv4 INADDR_ANY and IPv6 IN6_IS_ADDR_UNSPECIFIED addresses, and
zero port numbers are represented by an asterisk ('*');
a UDP destination address may be followed by the amount of time
elapsed since the last packet was sent to the destination;
TCP and UDP remote addresses may be followed by TCP/TPI
information in parentheses \- state (e.g., ``(ESTABLISHED)'', ``(Unbound)''),
queue sizes, and window sizes (not all dialects) \- in a fashion
similar to what
.IR netstat (1)
reports;
see the
.B \-T
option description or the description of the TCP/TPI field in
.B "OUTPUT FOR OTHER PROGRAMS"
for more information on state, queue size, and window size;
.IP
or the address or name of a UNIX domain socket, possibly including
a stream clone device name, a file system object's path name, local
and foreign kernel addresses, socket pair information, and a bound
vnode address;
.IP
or the local and remote mount point names of an NFS file;
.IP
or ``STR'', followed by the stream name;
.IP
or a stream character device name, followed by ``->'' and the stream name
or a list of stream module names, separated by ``->'';
.IP
or ``STR:'' followed by the SCO OpenServer stream device and module
names, separated by ``->'';
.IP
or system directory name, `` -- '', and as many components of the path
name as
.I lsof
can find in the kernel's name cache for selected dialects
(See the
.B "KERNEL NAME CACHE"
section for more information.);
.IP
or ``PIPE->'', followed by a Solaris kernel pipe destination address;
.IP
or ``COMMON:'', followed by the vnode device information structure's
device name, for a Solaris common vnode;
.IP
or the address family, followed by a slash (`/'), followed by fourteen
comma\-separated bytes of a non\-Internet raw socket address;
.IP
or the HP\-UX x.25 local address, followed by the virtual connection
number (if any), followed by the remote address (if any);
.IP
or ``(dead)'' for disassociated DEC OSF/1, Digital UNIX, or Tru64 UNIX
files \- typically terminal files that have been flagged with the TIOCNOTTY
ioctl and closed by daemons;
.IP
or ``rd=<offset>'' and ``wr=<offset>'' for the values of the
read and write offsets of a FIFO;
.IP
or ``clone \fIn\fP:/dev/event'' for SCO OpenServer file clones of the
.I /dev/event
device, where
.I n
is the minor device number of the file;
.IP
or ``(socketpair: n)'' for a Solaris 2.6, 8, 9  or 10
UNIX domain socket, created by the
.IR socketpair (3N)
network function;
.IP
or ``no PCB'' for socket files that do not have a protocol block
associated with them, optionally followed by ``, CANTSENDMORE'' if
sending on the socket has been disabled, or ``, CANTRCVMORE'' if
receiving on the socket has been disabled (e.g., by the
.IR shutdown (2)
function);
.IP
or the local and remote addresses of a Linux IPX socket file
in the form <net>:[<node>:]<port>, followed in parentheses
by the transmit and receive queue sizes, and the connection state;
.IP
or ``dgram'' or ``stream'' for the type UnixWare 7.1.1 and above in\-kernel
UNIX domain sockets, followed by a colon (':') and the local path name
when available, followed by ``->'' and the remote path name or kernel
socket address in hexadecimal when available.
.PP
For dialects that support a ``namefs'' file system, allowing one
file to be attached to another with
.IR fattach (3C),
.I lsof
will add ``(FA:<address1><direction><address2>)'' to the NAME column.
<address1> and <address2> are hexadecimal vnode addresses.
<direction> will be ``<-'' if <address2> has been fattach'ed to
this vnode whose address is <address1>;
and ``->'' if <address1>, the vnode address of this vnode, has been
fattach'ed to <address2>.
<address1> may be omitted if it already appears in the DEVICE column.
.SH LOCKS
.I Lsof
can't adequately report the wide variety of UNIX dialect file locks
in a single character.
What it reports in a single character is a compromise between the
information it finds in the kernel and the limitations of the reporting
format.
.PP
Moreover, when a process holds several byte level locks on a file,
.I lsof
only reports the status of the first lock it encounters.
If it is a byte level lock, then the lock character will be reported
in lower case \- i.e., `r', `w', or `x' \- rather than the upper case
equivalent reported for a full file lock.
.PP
Generally
.I lsof
can only report on locks held by local processes on local files.
When a local process sets a lock on a remotely mounted (e.g., NFS)
file, the remote server host usually records the lock state.
One exception is Solaris \- at some patch levels of 2.3, and in all
versions above 2.4, the Solaris kernel records information on remote
locks in local structures.
.PP
.I Lsof
has trouble reporting locks for some UNIX dialects.
Consult the
.B BUGS
section of this manual page or the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for more information.
.SH "OUTPUT FOR OTHER PROGRAMS"
When the
.B \-F
option is specified,
.I lsof
produces output that is suitable for processing by another program \- e.g, an
.I awk
or
.I Perl
script, or a C program.
.PP
Each unit of information is output in a field that is identified
with a leading character and terminated by a NL (012) (or a NUL
(000) if the 0 (zero) field identifier character is specified.)
The data of the field follows immediately after the field identification
character and extends to the field terminator.
.PP
It is possible to think of field output as process and file sets.
A process set begins with a field whose identifier is `p' (for
process IDentifier (PID)).
It extends to the beginning of the next PID field or the beginning
of the first file set of the process, whichever comes first.
Included in the process set are fields that identify the command,
the process group IDentification (PGID) number, and the user ID (UID)
number or login name.
.PP
A file set begins with a field whose identifier is `f' (for
file descriptor).
It is followed by lines that describe the file's access mode,
lock state, type, device, size, offset, inode, protocol, name
and stream module names.
It extends to the beginning of the next file or process set,
whichever comes first.
.PP
When the NUL (000) field terminator has been selected with the
0 (zero) field identifier character,
.I lsof
ends each process and file set with a NL (012) character.
.PP
.I Lsof
always produces one field, the PID (`p') field.
All other fields may be declared optionally in the field identifier
character list that follows the
.B \-F
option.
When a field selection character identifies an item
.I lsof
does not normally list \- e.g., PPID, selected with
.BR \-R " \-"
specification of the field character \- e.g., ``\fB\-FR\fP'' \-
also selects the listing of the item.
.PP
It is entirely possible to select a set of fields that cannot
easily be parsed \- e.g., if the field descriptor field is not
selected, it may be difficult to identify file sets.
To help you avoid this difficulty,
.I lsof
supports the
.B \-F
option; it selects the output of all fields with NL terminators
(the
.B \-F0
option pair selects the output of all fields with NUL terminators).
For compatibility reasons neither
.B \-F
nor
.B \-F0
select the raw device field.
.PP
These are the fields that
.I lsof
will produce.
The single character listed first is the field identifier.
.PP
.nf
	a	file access mode
	c	process command name (all characters from proc or
		user structure)
	C	file structure share count
	d	file's device character code 
	D	file's major/minor device number (0x<hexadecimal>)
	f	file descriptor
	F	file structure address (0x<hexadecimal>)
	G	file flaGs (0x<hexadecimal>; names if \fB+fg\fP follows)
	i	file's inode number
	k	link count
	l	file's lock status
	L	process login name
	m	marker between repeated output
	n	file name, comment, Internet address
	N	node identifier (ox<hexadecimal>
	o	file's offset (decimal)
	p	process ID (always selected)
	g	process group ID
	P	protocol name
	r	raw device number (0x<hexadecimal>)
	R	parent process ID
	s	file's size (decimal)
	S	file's stream identification
	t	file's type
	T	TCP/TPI information, identified by prefixes (the
		`=' is part of the prefix):
		    QR=<read queue size>
		    QS=<send queue size>
		    SO=<socket options and values> (not all dialects)
		    SS=<socket states> (not all dialects)
		    ST=<connection state>
		    TF=<TCP flags and values> (not all dialects)
		    WR=<window read size>  (not all dialects)
		    WW=<window write size>  (not all dialects)
		(TCP/TPI information isn't reported for all supported
		  UNIX dialects. The \fB\-h\fP or \fB\-?\fP help output for the
		  \fB\-T\fP option will show what TCP/TPI reporting can be
		  requested.)
	u	process user ID
	z	Solaris 10 and higher zone name
	0	use NUL field terminator character in place of NL
	1-\9	dialect\-specific field identifiers (The output
		of \fB\-F?\fP identifies the information to be found
		in dialect\-specific fields.)
.fi
.PP
You can get on\-line help information on these characters and their
descriptions by specifying the
.B \-F?
option pair.
(Escape the `?' character as your shell requires.)
Additional information on field content can be found in the
.B OUTPUT
section.
.PP
As an example, ``\fB\-F pcfn\fP'' will select the process ID (`p'),
command name (`c'), file descriptor (`f') and file name (`n')
fields with an NL field terminator character; ``\fB\-F pcfn0\fP''
selects the same output with a NUL (000) field terminator character.
.PP
.I Lsof
doesn't produce all fields for every process or file set, only
those that are available.
Some fields are mutually exclusive: file device characters and
file major/minor device numbers; file inode number and protocol
name; file name and stream identification; file size and offset.
One or the other member of these mutually exclusive sets will appear
in field output, but not both.
.PP
Normally
.I lsof
ends each field with a NL (012) character.
The
0 (zero) field identifier character may be specified to change the
field terminator character
to a NUL (000).
A NUL terminator may be easier to process with
.I xargs (1),
for example, or with programs whose quoting mechanisms may not
easily cope with the range of characters in the field output.
When the NUL field terminator is in use,
.I lsof
ends each process and file set with a NL (012).
.PP
Three aids to producing programs that can process
.I lsof
field output are included in the
.I lsof
distribution.
The first is a C header file,
.IR lsof_fields.h ,
that contains symbols for the field identification characters, indexes for
storing them in a table, and explanation strings that may be compiled into
programs.
.I Lsof
uses this header file.
.PP
The second aid is a set of sample scripts that process field output,
written in
.IR awk ,
.I Perl
4, and
.I Perl
5.
They're located in the
.I scripts
subdirectory of the
.I lsof
distribution.
.PP
The third aid is the C library used for the
.I lsof
test suite.
The test suite is written in C and uses field output to validate
the correct operation of
.IR lsof .
The library can be found in the
.I tests/LTlib.c
file of the
.I lsof
distribution.
The library uses the first aid, the
.I lsof_fields.h
header file.
.SH "BLOCKS AND TIMEOUTS"
.I Lsof
can be blocked by some kernel functions that it uses \-
.IR lstat (2),
.IR readlink (2),
and
.IR stat (2).
These functions are stalled in the kernel, for example, when the
hosts where mounted NFS file systems reside become inaccessible.
.PP
.I Lsof
attempts to break these blocks with timers and child processes,
but the techniques are not wholly reliable.
When
.I lsof
does manage to break a block, it will report the break with an error
message.
The messages may be suppressed with the
.B \-t
and
.B \-w
options.
.PP
The default timeout value may be displayed with the
.B \-h
or
.B \-?
option, and it may be changed with the
.BI \-S " [t]"
option.
The minimum for
.I t
is two seconds, but you should avoid small values, since slow system
responsiveness can cause short timeouts to expire unexpectedly and
perhaps stop
.I lsof
before it can produce any output.
.PP
When
.I lsof
has to break a block during its access of mounted file system
information, it normally continues, although with less information
available to display about open files.
.PP
.I Lsof
can also be directed to avoid the protection of timers and child processes
when using the kernel functions that might block by specifying the
.B \-O
option.
While this will allow
.I lsof
to start up with less overhead, it exposes
.I lsof
completely to the kernel situations that might block it.
Use this option cautiously.
.SH "AVOIDING KERNEL BLOCKS"
.PP
You can use the
.B \-b
option to tell
.I lsof
to avoid using kernel functions that would block.
Some cautions apply.
.PP
First, using this option usually requires that your system supply
alternate device numbers in place of the device numbers that
.I lsof
would normally obtain with the
.IR lstat (2)
and
.IR stat (2)
kernel functions.
See the
.B "ALTERNATE DEVICE NUMBERS"
section for more information on alternate device numbers.
.PP
Second, you can't specify
.I names
for
.I lsof
to locate unless they're file system names.
This is because
.I lsof
needs to know the device and inode numbers of files listed with
.I names
in the
.I lsof
options, and the
.B \-b
option prevents
.I lsof
from obtaining them.
Moreover, since
.I lsof
only has device numbers for the file systems that have alternates,
its ability to locate files on file systems depends completely on the
availability and accuracy of the alternates.
If no alternates are available, or if they're incorrect,
.I lsof
won't be able to locate files on the named file systems.
.PP
Third, if the names of your file system directories that
.I lsof
obtains from your system's mount table are symbolic links,
.I lsof
won't be able to resolve the links.
This is because the
.B \-b
option causes
.I lsof
to avoid the kernel
.IR readlink (2)
function it uses to resolve symbolic links.
.PP
Finally, using the
.B \-b
option causes
.I lsof
to issue warning messages when it needs to use the kernel functions
that the
.B \-b
option directs it to avoid.
You can suppress these messages by specifying the
.B \-w
option, but if you do, you won't see the alternate device numbers
reported in the warning messages.
.SH "ALTERNATE DEVICE NUMBERS"
.PP
On some dialects, when
.I lsof
has to break a block because it can't get information about a
mounted file system via the
.IR lstat (2)
and
.IR stat (2)
kernel functions, or because you specified the
.B \-b
option,
.I lsof
can obtain some of the information it needs \- the device number and
possibly the file system type \- from the system mount table.
When that is possible,
.I lsof
will report the device number it obtained.
(You can suppress the report by specifying the
.B \-w
option.)
.PP
You can assist this process if your mount table is supported with an
.I /etc/mtab
or
.I /etc/mnttab
file that contains an options field by adding a ``dev=xxxx'' field for
mount points that do not have one in their options strings.
Note: you must be able to edit the file \- i.e., some mount tables
like recent Solaris /etc/mnttab or Linux /proc/mounts are read\-only
and can't be modified.
.PP
You may also be able to supply device numbers using the
.B +m
and
.BI +m " m"
options, provided they are supported by your dialect.
Check the output of
.I lsof's
.B \-h
or
.B \-?
options to see if the
.B +m
and
.BI +m " m"
options are available.
.PP
The ``xxxx'' portion of the field is the hexadecimal value
of the file system's device number.
(Consult the
.I st_dev
field of the output of the
.IR lstat (2)
and
.IR stat (2)
functions for the appropriate values for your file systems.)
Here's an example from a Sun Solaris 2.6
.I /etc/mnttab
for a file system remotely mounted via NFS:
.PP
.nf
	nfs  ignore,noquota,dev=2a40001
.fi
.PP
There's an advantage to having ``dev=xxxx'' entries in your mount
table file, especially for file systems that are mounted from remote
NFS servers.
When a remote server crashes and you want to identify its users by running
.I lsof
on one of its clients,
.I lsof
probably won't be able to get output from the
.IR lstat (2)
and
.IR stat (2)
functions for the file system.
If it can obtain the file system's device number from the mount table,
it will be able to display the files open on the crashed NFS server.
.PP
Some dialects that do not use an ASCII
.I /etc/mtab
or
.I /etc/mnttab
file for the mount table may still provide an alternative device number
in their internal mount tables.
This includes AIX, Apple Darwin, DEC OSF/1, Digital UNIX,
FreeBSD, NetBSD, OpenBSD, and Tru64 UNIX.
.I Lsof
knows how to obtain the alternative device number for these dialects
and uses it when its attempt to
.IR lstat (2)
or
.IR stat (2)
the file system is blocked.
.PP
If you're not sure your dialect supplies alternate device numbers
for file systems from its mount table, use this
.I lsof
incantation to see if it reports any alternate device numbers:
.PP
.IP
lsof -b
.PP
Look for standard error file warning messages that
begin ``assuming "dev=xxxx" from ...''.
.SH "KERNEL NAME CACHE"
.PP
.I Lsof
is able to examine the kernel's name cache or use other kernel
facilities (e.g., the ADVFS 4.x tag_to_path() function under
Digital UNIX or Tru64 UNIX) on some dialects for most file system types,
excluding AFS, and extract recently used path name components from it.
(AFS file system path lookups don't use the kernel's name cache; some
Solaris VxFS file system operations apparently don't use it, either.)
.PP
.I Lsof
reports the complete paths it finds in the NAME column.
If
.I lsof
can't report all components in a path, it reports in the NAME column
the file system name, followed by a space, two `-' characters, another
space, and the name components it has located, separated by
the `/' character.
.PP
When
.I lsof
is run in repeat mode \- i.e., with the
.B \-r
option specified \- the extent to which it can report path name
components for the same file may vary from cycle to cycle.
That's because other running processes can cause the kernel to
remove entries from its name cache and replace them with others.
.PP
.I Lsof's
use of the kernel name cache to identify the paths of files
can lead it to report incorrect components under some circumstances.
This can happen when the kernel name cache uses device and node
number as a key (e.g., SCO OpenServer) and a key on a rapidly
changing file system is reused.
If the UNIX dialect's kernel doesn't purge the name cache entry for
a file when it is unlinked,
.I lsof
may find a reference to the wrong entry in the cache.
The
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
has more information on this situation.
.PP
.I Lsof
can report path name components for these dialects:
.PP
.nf
	BSDI BSD/OS
	DEC OSF/1, Digital UNIX, Tru64 UNIX
	FreeBSD
	HP\-UX
	Linux
	NetBSD
	NEXTSTEP
	OpenBSD
	OPENSTEP
	Caldera OpenUNIX
	SCO OpenServer
	SCO|Caldera UnixWare
	Solaris
.fi
.PP
.I Lsof
can't report path name components for these dialects:
.PP
.nf
	AIX
.fi
.PP
If you want to know why
.I lsof
can't report path name components for some dialects, see the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
.SH "DEVICE CACHE FILE"
.PP
Examining all members of the
.I /dev
(or
.IR /devices )
node tree with
.IR stat (2)
functions can be time consuming.
What's more, the information that
.I lsof
needs \- device number, inode number, and path \- rarely changes.
.PP
Consequently,
.I lsof
normally maintains an ASCII text file of cached
.I /dev
(or
.IR /devices )
information (exception: the /proc\-based Linux
.I lsof
where it's not needed.)
The local system administrator who builds
.I lsof
can control the way the device cache file path is formed, selecting
from these options:
.PP
.nf
	Path from the \fB\-D\fP option;
	Path from an environment variable;
	System\-wide path;
	Personal path (the default);
	Personal path, modified by an environment variable.
.fi
.PP
Consult the output of the
.BR \-h ,
.B \-D? ,
or
.B \-?
help options for the current state of device cache support.
The help output lists the default read\-mode device cache file path that
is in effect for the current invocation of
.IR lsof .
The
.B \-D?
option output lists the read\-only and write device cache file paths,
the names of any applicable environment variables, and the personal
device cache path format.
.PP
.I Lsof
can detect that the current device cache file has been accidentally
or maliciously modified by integrity checks, including the computation
and verification of a sixteen bit Cyclic Redundancy Check (CRC) sum on
the file's contents.
When
.I lsof
senses something wrong with the file, it issues a warning and attempts
to remove the current cache file and create a new copy, but only to
a path that the process can legitimately write.
.PP
The path from which a
.I lsof
process may attempt to read a device cache file may not be the same
as the path to which it can legitimately write.
Thus when
.I lsof
senses that it needs to update the device cache file, it may
choose a different path for writing it from the path from which
it read an incorrect or outdated version.
.PP
If available, the
.B \-Dr
option will inhibit the writing of a new device cache file.
(It's always available when specified without a path name argument.)
.PP
When a new device is added to the system, the device cache file may
need to be recreated.
Since
.I lsof
compares the mtime of the device cache file with the mtime and ctime
of the
.I /dev
(or
.IR /devices )
directory, it usually detects that a new device has been added;
in that case
.I lsof
issues a warning message and attempts to rebuild the device cache file.
.PP
Whenever
.I lsof
writes a device cache file, it sets its ownership to the real UID
of the executing process, and its permission modes to 0600, this
restricting its reading and writing to the file's owner.
.SH "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
.PP
Two permissions of the
.I lsof
executable affect its ability to access device cache files.
The permissions are set by the local system administrator when
.I lsof
is installed.
.PP
The first and rarer permission is setuid\-root.
It comes into effect when
.I lsof
is executed; its effective UID is then
root, while its real (i.e., that of the logged\-on user) UID is not.
The
.I lsof
distribution recommends that versions for these dialects run setuid\-root.
.PP
.nf
	HP-UX 11.11
	Linux
.fi
.PP
The second and more common permission is setgid.
It comes into effect when the effective group IDentification number (GID)
of the
.I lsof
process is set to one that can access kernel memory devices \-
e.g., ``kmem'', ``sys'', or ``system''.
.PP
An
.I lsof
process that has setgid permission usually surrenders the permission
after it has accessed the kernel memory devices.
When it does that,
.I lsof
can allow more liberal device cache path formations.
The
.I lsof
distribution recommends that versions for these dialects run setgid
and be allowed to surrender setgid permission.
.PP
.nf
	AIX 5.[123]
	Apple Darwin 6.x and 7.x for Power Macintosh systems
	BSDI BSD/OS 4.3.1 for x86-based systems
	DEC OSF/1, Digital UNIX, Tru64 UNIX 4.0, and 5.1
	FreeBSD 4.[1-9], 4.1[01], 5.[012] and 6.0 for x86-based systems
	FreeBSD 5.[012] and 6.0 for Alpha, AMD64 and Sparc64 based systems
	HP\-UX 11.00 
	NetBSD 1.[456] and 2.x for Alpha, x86, and SPARC-based systems
	NEXTSTEP 3.[13] for NEXTSTEP architectures
	OpenBSD 2.[89] and 3.[0123456] for x86-based systems
	OPENSTEP 4.x
	Caldera OpenUNIX 8
	SCO OpenServer Release 5.0.6 for x86-based systems
	SCO|Caldera UnixWare 7.1.4 for x86-based systems
	Solaris 2.6, 8, 9 and 10
.fi
.PP
(Note:
.I lsof
for AIX 5L and above needs setuid\-root permission if its
.B \-X
option is used.)
.PP
.I Lsof
for these dialects does not support a device cache, so the permissions
given to the executable don't apply to the device cache file.
.PP
.nf
	Linux
.fi
.SH "DEVICE CACHE FILE PATH FROM THE \-D OPTION"
.PP
The
.B \-D
option provides limited means for specifying the device cache file path.
Its
.B ?
function will report the read\-only and write device cache file paths that
.I lsof
will use.
.PP
When the
.B \-D
.BR b ,
.BR r ,
and
.B u
functions are available, you can use them to request that the cache file be
built in a specific location (\fBb\fR[\fIpath\fR]);
read but not rebuilt (\fBr\fR[\fIpath\fR]);
or read and rebuilt (\fBu\fR[\fIpath\fR]).
The
.BR b ,
.BR r ,
and
.B u
functions are restricted under some conditions.
They are restricted when the
.I lsof
process is setuid\-root.
The path specified with the
.B r
function is always read\-only, even
when it is available.
.PP
The
.BR b ,
.BR r ,
and
.B u
functions are also restricted when the
.I lsof
process runs setgid and
.I lsof
doesn't surrender the setgid permission.
(See the
.B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
section for a list of implementations that normally don't surrender
their setgid permission.)
.PP
A further
.B \-D
function,
.B i
(for ignore), is always available.
.PP
When available, the
.B b
function tells
.I lsof
to read device information from the kernel with the
.IR stat (2)
function and build a device cache file at the indicated path.
.PP
When available, the
.B r
function tells
.I lsof
to read the device cache file, but not update it.
When a path argument accompanies
.BR \-Dr ,
it names the device cache file path.
The
.B r
function is always available when it is specified without a
path name argument.
If
.I lsof
is not running setuid\-root and surrenders its setgid permission,
a path name argument may accompany the
.B r
function.
.PP
When available, the
.B u
function tells
.I lsof
to attempt to read and use the device cache file.
If it can't read the file, or if it finds the contents of the
file incorrect or outdated, it will read information from the kernel,
and attempt to write an updated version of the device cache file,
but only to a path it considers legitimate for the
.I lsof
process effective and real UIDs.
.SH "DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE"
.PP
.I Lsof's
second choice for the device cache file is the contents of the
LSOFDEVCACHE environment variable.
It avoids this choice if the
.I lsof
process is setuid\-root, or the real UID of the process is root.
.PP
A further restriction applies to a device cache file path taken from
the LSOFDEVCACHE environment variable:
.I lsof
will not write a device cache file to the path if the
.I lsof
process doesn't surrender its setgid permission.
(See the
.B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
section for information on implementations that don't surrender
their setgid permission.)
.PP
The local system administrator can disable the use of the LSOFDEVCACHE
environment variable or change its name when building
.IR lsof .
Consult the output of
.B \-D?
for the environment variable's name.
.SH "SYSTEM-WIDE DEVICE CACHE PATH"
.PP
The local system administrator may choose to have a system\-wide
device cache file when building
.IR lsof .
That file will generally be constructed by a special system administration
procedure when the system is booted or when the contents of
.I /dev
or
.IR /devices )
changes.
If defined, it is
.I lsof's
third device cache file path choice.
.PP
You can tell that a system\-wide device cache file is in effect
for your local installation by examining the
.I lsof
help option output \- i.e., the output from the
.B \-h
or
.B \-?
option.
.PP
.I Lsof
will never write to the system\-wide device cache file path by
default.
It must be explicitly named with a
.B \-D
function in a root\-owned procedure.
Once the file has been written, the procedure must change its permission
modes to 0644 (owner\-read and owner\-write, group\-read, and other\-read).
.SH "PERSONAL DEVICE CACHE PATH (DEFAULT)"
.PP
The default device cache file path of the
.I lsof
distribution is one recorded in the home directory of the real UID
that executes
.IR lsof .
Added to the home directory is a second path component of the form
.IR .lsof_hostname .
.PP
This is
.I lsof's
fourth device cache file path choice, and is
usually the default.
If a system\-wide device cache file path was defined when
.I lsof
was built,
this fourth choice will be applied when
.I lsof
can't find the system\-wide device cache file.
This is the
.B only
time
.I lsof
uses two paths when reading the device cache file.
.PP
The
.I hostname
part of the second component is the base
name of the executing host, as returned by
.IR gethostname (2).
The base name is defined to be the characters preceding the first `.'
in the
.IR gethostname (2)
output, or all the
.IR gethostname (2)
output if it contains no `.'.
.PP
The device cache file belongs to the user ID and is readable and
writable by the user ID alone \- i.e., its modes are 0600.
Each distinct real user ID on a given host that executes
.I lsof
has a distinct device cache file.
The
.I hostname
part of the path distinguishes device cache files in an NFS\-mounted
home directory into which device cache files are written from
several different hosts.
.PP
The personal device cache file path formed by this method represents
a device cache file that
.I lsof
will attempt to read, and will attempt to write should it not
exist or should its contents be incorrect or outdated.
.PP
The
.B \-Dr
option without a path name argument will inhibit the writing of a new
device cache file.
.PP
The
.B \-D?
option will list the format specification for constructing the
personal device cache file.
The conversions used in the format specification are described in the
.I 00DCACHE
file of the
.I lsof
distribution.
.SH "MODIFIED PERSONAL DEVICE CACHE PATH"
.PP
If this option is defined by the local system administrator when
.I lsof
is built, the LSOFPERSDCPATH environment variable contents may
be used to add a component of the personal device cache file path.
.PP
The LSOFPERSDCPATH variable contents are inserted in the path at the
place marked by the local system administrator with the ``%p''
conversion in the HASPERSDC format specification of the dialect's
.I machine.h 
header file.
(It's placed right after the home directory in the default
.I lsof
distribution.)
.PP
Thus, for example, if LSOFPERSDCPATH contains ``LSOF'', the home
directory is ``/Homes/abe'', the host name is ``lsof.itap.purdue.edu'',
and the HASPERSDC format is the default (``%h/%p.lsof_%L''), the
modified personal device cache file path is:
.PP
.nf
	/Homes/abe/LSOF/.lsof_vic
.fi
.PP
The LSOFPERSDCPATH environment variable is ignored when the
.I lsof
process is setuid\-root or when the real UID of the process is root.
.PP
.I Lsof
will not write to a modified personal device cache file path if the
.I lsof
process doesn't surrender setgid permission.
(See the
.B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
section for a list of implementations that normally don't surrender
their setgid permission.)
.PP
If, for example, you want to create a sub\-directory of personal
device cache file paths by using the LSOFPERSDCPATH environment
variable to name it, and
.I lsof
doesn't surrender its setgid permission, you will have to allow
.I lsof
to create device cache files at the standard personal path and
move them to your subdirectory with shell commands.
.PP
The local system administrator may: disable this option when
.I lsof
is built; change the name of the environment variable from
LSOFPERSDCPATH to something else; change the HASPERSDC
format to include the personal path component in another place;
or exclude the personal path component entirely.
Consult the output of the
.B \-D?
option for the environment variable's name and the HASPERSDC
format specification.
.SH DIAGNOSTICS
Errors are identified with messages on the standard error file.
.PP
.I Lsof
returns a one (1) if any error was detected, including the failure to
locate command names, file names, Internet addresses or files, login
names, NFS files, PIDs, PGIDs, or UIDs it was asked to list.
If the
.B \-V
option is specified,
.I lsof
will indicate the search items it failed to list.
.PP
It returns a zero (0) if no errors were detected and if it was able to
list some information about all the specified search arguments.
.PP
.PP
When
.I lsof
cannot open access to
.I /dev
(or
.IR /devices )
or one of its subdirectories, or get information on a file in them with
.IR stat (2),
it issues a warning message and continues.
That
.I lsof
will issue warning messages about inaccessible files in
.I /dev
(or
.IR /devices )
is indicated in its help output \- requested with the
.B \-h
or
>B \-?
options \-  with the message:
.PP
.nf
	Inaccessible /dev warnings are enabled.
.fi
.PP
The warning message may be suppressed with the
.B \-w
option.
It may also have been suppressed by the system administrator when
.I lsof
was compiled by the setting of the WARNDEVACCESS definition.
In this case, the output from the help options will include the message:
.PP
.nf
	Inaccessible /dev warnings are disabled.
.fi
.PP
Inaccessible device warning messages usually disappear after
.I lsof
has created a working device cache file.
.SH EXAMPLES
For a more extensive set of examples, documented more fully, see the
.I 00QUICKSTART
file of the
.I lsof
distribution.
.PP
To list all open files, use:
.IP
lsof
.PP
To list all open Internet, x.25 (HP\-UX), and UNIX domain files, use:
.IP
lsof -i -U
.PP
To list all open IPv4 network files in use by the process whose PID is
1234, use:
.IP
lsof -i 4 -a -p 1234
.PP
Presuming the UNIX dialect supports IPv6, to list only open IPv6
network files, use:
.IP
lsof -i 6
.PP
To list all files using any protocol on ports 513, 514, or 515 of host
wonderland.cc.purdue.edu, use:
.IP
lsof -i @wonderland.cc.purdue.edu:513-515
.PP
To list all files using any protocol on any port of mace.cc.purdue.edu
(cc.purdue.edu is the default domain), use:
.IP
lsof -i @mace
.PP
To list all open files for login name ``abe'', or user ID 1234, or
process 456, or process 123, or process 789, use:
.IP
lsof -p 456,123,789 -u 1234,abe
.PP
To list all open files on device /dev/hd4, use:
.IP
lsof /dev/hd4
.PP
To find the process that has /u/abe/foo open, use:
.IP
lsof /u/abe/foo
.PP
To send a SIGHUP to the processes that have /u/abe/bar open, use:
.IP
kill -HUP `lsof -t /u/abe/bar`
.PP
To find any open file, including an open UNIX domain socket file,
with the name
.IR /dev/log ,
use:
.IP
lsof /dev/log
.PP
To find processes with open files on the NFS file system named
.I /nfs/mount/point
whose server is inaccessible, and presuming your mount table supplies
the device number for
.IR /nfs/mount/point ,
use:
.IP
lsof -b /nfs/mount/point
.PP
To do the preceding search with warning messages suppressed, use:
.IP
lsof -bw /nfs/mount/point
.PP
To ignore the device cache file, use:
.IP
lsof -Di
.PP
To obtain PID and command name field output for each process, file
descriptor, file device number, and file inode number for each file
of each process, use:
.IP
lsof -FpcfDi
.PP
To list the files at descriptors 1 and 3 of every process running the
.I lsof
command for login ID ``abe'' every 10 seconds, use:
.IP
lsof -c lsof -a -d 1 -d 3 -u abe -r10
.PP
To list the current working directory of processes running a command that
is exactly four characters long and has an 'o' or 'O' in character three,
use this regular expression form of the
.BI \-c " c"
option:
.IP
lsof -c /^..o.$/i -a -d cwd
.PP
To find an IP version 4 socket file by its associated numeric dot\-form
address, use:
.IP
lsof -i@128.210.15.17
.PP
To find an IP version 6 socket file (when the UNIX dialect supports
IPv6) by its associated numeric colon\-form address, use:
.IP
lsof -i@[0:1:2:3:4:5:6:7]
.PP
To find an IP version 6 socket file (when the UNIX dialect supports
IPv6) by an associated numeric colon\-form address that has a run of
zeroes in it \- e.g., the loop\-back address \- use:
.IP
lsof -i@[::1]
.SH BUGS
Since
.I lsof
reads kernel memory in its search for open files, rapid changes in kernel
memory may produce unpredictable results.
.PP
When a file has multiple record locks, the lock status character
(following the file descriptor) is derived from a test of the first
lock structure, not from any combination of the individual record
locks that might be described by multiple lock structures.
.PP
.I Lsof
can't search for files with restrictive access permissions by
.I name
unless it is installed with root set\-UID permission.
Otherwise it is limited to searching for files to which its user
or its set-GID group (if any) has access permission.
.PP
The display of the destination address of a raw socket (e.g., for
.IR ping )
depends on the UNIX operating system.
Some dialects store the destination address in the raw socket's protocol
control block, some do not.
.PP
.I Lsof
can't always represent Solaris device numbers in the same way that
.IR ls (1)
does.
For example, the major and minor device numbers that the
.IR lstat (2)
and
.IR stat (2)
functions report for the directory on which CD-ROM files are mounted
(typically 
.IR /cdrom )
are not the same as the ones that it reports for the device on which
CD-ROM files are mounted (typically
.IR /dev/sr0 ).
(\fILsof\fP reports the directory numbers.)
.PP
The support for
.I /proc
file systems is available only for BSD, DEC OSF/1, Digital UNIX, and Tru64
UNIX dialects, Linux, and dialects derived from SYSV R4 \- e.g., FreeBSD,
NetBSD, OpenBSD, Solaris, UnixWare.
.PP
Some
.I /proc
file items \- device number, inode number, and file size \-
are unavailable in some dialects.
Searching for files in a
.I /proc
file system may require that the full path name be specified.
.PP
No text (\fBtxt\fP) file descriptors are displayed for Linux
processes.
All entries for files other than the current working directory,
the root directory, and numerical file descriptors are labeled
.B mem
descriptors.
.PP
.I Lsof
can't search for DEC OSF/1, Digital UNIX, and Tru64 UNIX named pipes
by name, because their kernel implementation of lstat(2) returns an
improper device number for a named pipe.
.PP
.I Lsof
can't report fully or correctly on HP\-UX 9.01, 10.20, and 11.00 locks
because of insufficient access to kernel data or errors in the
kernel data.
See the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
for details.
.PP
The AIX SMT file type is a fabrication.
It's made up for file structures whose type (15) isn't defined in the AIX
.I /usr/include/sys/file.h
header file.
One way to create such file structures is to run X clients with the DISPLAY
variable set to ``:0.0''.
.PP
The
.BI +|\-f [cfgGn]
option is not supported under /proc\-based Linux
.IR lsof ,
because it doesn't read kernel structures from kernel memory.
.SH ENVIRONMENT
.I Lsof
may access these environment variables.
.TP \w'LSOFPERSDCPATH'u+4
LANG
defines a language locale.
See
.IR setlocale (3)
for the names of other variables that can be used in place
of LANG \- e.g., LC_ALL, LC_TYPE, etc.
.TP
LSOFDEVCACHE
defines the path to a device cache file.
See the
.B "DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE"
section for more information.
.TP
LSOFPERSDCPATH
defines the middle component of a modified personal device cache
file path.
See the
.B "MODIFIED PERSONAL DEVICE CACHE PATH"
section for more information.
.SH FAQ
Frequently-asked questions and their answers (an FAQ) are
available in the
.I 00FAQ
file of the
.I lsof
distribution.
.PP
That file is also available via anonymous ftp from
.I lsof.itap.purdue.edu
at
.IR pub/tools/unix/lsof FAQ .
The URL is:
.IP
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
.SH FILES
.TP \w'.lsof_hostname'u+4
.I /dev/kmem
kernel virtual memory device
.TP
.I /dev/mem
physical memory device
.TP
.I /dev/swap
system paging device
.TP
.I .lsof_hostname
.I lsof's
device cache file
(The suffix,
.IR hostname ,
is the first component of the host's name returned by
.IR gethostname (2) .)
.SH AUTHORS
.I Lsof
was written by Victor A. Abell <abe@purdue.edu> of Purdue University.
Many others have contributed to
.IR lsof .
They're listed in the
.I 00CREDITS
file of the
.I lsof
distribution.
.SH DISTRIBUTION
The latest distribution of
.I lsof
is available via anonymous ftp from the host
.IR lsof.itap.purdue.edu .
You'll find the
.I lsof
distribution in the
.I pub/tools/unix/lsof
directory.
.PP
You can also use this URL:
.IP
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
.PP
.I Lsof
is also mirrored elsewhere.
When you access
.I lsof.itap.purdue.edu
and change to its
.I pub/tools/unix/lsof
directory, you'll be given a list of some mirror sites.
The
.I pub/tools/unix/lsof
directory also contains a more complete list in its
.I mirrors
file.
Use mirrors with caution \- not all mirrors always have the latest
.I lsof
revision.
.PP
Some pre\-compiled
.I Lsof
executables are available on
.IR lsof.itap.purdue.edu ,
but their use is discouraged \- it's better that you build
your own from the sources.
If you feel you must use a pre\-compiled executable, please
read the cautions that appear in the README files of the
.I pub/tools/unix/lsof/binaries
subdirectories and in the 00* files of the distribution.
.PP
More information on the
.I lsof
distribution can be found in its
.I README.lsof_<version>
file.
If you intend to get the
.I lsof
distribution and build it, please read
.I README.lsof_<version>
and the other 00* files of the distribution before sending questions
to the author.
.SH SEE ALSO
.PP
Not all the following manual pages may exist in every UNIX
dialect to which
.I lsof
has been ported.
.PP
access(2),
awk(1),
crash(1),
fattach(3C),
ff(1),
fstat(8),
fuser(1),
gethostname(2),
isprint(3),
kill(1),
lstat(2),
modload(8),
mount(8),
netstat(1),
ofiles(8L),
perl(1),
ps(1),
readlink(2),
setlocale(3),
stat(2),
uname(1).