2021-10-01 20:40:12 +02:00
|
|
|
//po4a: entry man manual
|
|
|
|
////
|
|
|
|
Copyright 2021 Red Hat, Inc.
|
|
|
|
|
|
|
|
This file may be copied under the terms of the GNU Public License.
|
|
|
|
////
|
|
|
|
= lsfd(1)
|
|
|
|
:doctype: manpage
|
|
|
|
:man manual: User Commands
|
|
|
|
:man source: util-linux {release-version}
|
|
|
|
:page-layout: base
|
|
|
|
:command: lsfd
|
|
|
|
|
|
|
|
== NAME
|
|
|
|
|
|
|
|
lsfd - list file descriptors
|
|
|
|
|
|
|
|
== SYNOPSIS
|
|
|
|
|
|
|
|
*lsfd* [option]
|
|
|
|
|
|
|
|
== DESCRIPTION
|
|
|
|
|
2021-10-03 15:58:38 +09:00
|
|
|
*lsfd* is intended to be a modern replacement for *lsof*(8) on Linux systems.
|
|
|
|
Unlike *lsof*, *lsfd* is specialized to Linux kernel; it supports Linux
|
2021-10-07 18:08:06 +09:00
|
|
|
specific features like namespaces with simpler code. *lsfd* is not a
|
2021-10-03 15:58:38 +09:00
|
|
|
drop-in replacement for *lsof*; they are different in the command line
|
|
|
|
interface and output formats.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
*lsfd* uses Libsmartcols for output formatting and filtering. See the description of *--output*
|
|
|
|
option for customizing the output format, and *--filter* option for filtering.
|
2021-10-01 20:40:12 +02:00
|
|
|
|
2021-10-03 16:06:20 +09:00
|
|
|
== OPTIONS
|
|
|
|
|
|
|
|
*-l*, *--threads*::
|
|
|
|
List in threads level.
|
|
|
|
|
|
|
|
*-J*, *--json*::
|
|
|
|
Use JSON output format.
|
|
|
|
|
|
|
|
*-n*, *--noheadings*::
|
|
|
|
Don't print headings.
|
|
|
|
|
|
|
|
*-o*, *--output* _list_::
|
2021-10-04 04:44:21 +09:00
|
|
|
Specify which output columns to print. See the "OUTPUT COLUMNS"
|
|
|
|
section for details of available column.
|
|
|
|
+
|
|
|
|
The default list of columns may be extended if _list_ is specified in
|
|
|
|
the format _+list_ (e.g., *lsfd -o +DELETED*).
|
2021-10-03 16:06:20 +09:00
|
|
|
|
|
|
|
*-r*, *--raw*::
|
|
|
|
Use raw output format.
|
|
|
|
|
|
|
|
*--sysroot* _dir_::
|
|
|
|
Use specified directory as system root.
|
|
|
|
|
|
|
|
*--notruncate*::
|
|
|
|
Don't truncate text in columns.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
*-Q*, *--filter* _expr_::
|
|
|
|
Print the files only satisfying with the condition represented by the _expr_.
|
|
|
|
|
2021-10-03 16:06:20 +09:00
|
|
|
*-h*, *--help*::
|
|
|
|
Display help text and exit.
|
|
|
|
|
2021-10-03 17:56:47 +09:00
|
|
|
*-V*, *--version*::
|
|
|
|
Display version information and exit.
|
|
|
|
|
2021-10-03 16:06:20 +09:00
|
|
|
== OUTPUT COLUMNS
|
2021-10-01 20:40:12 +02:00
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
Each column has a type. Types are surround by < and >.
|
|
|
|
|
|
|
|
ASSOC <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Association between file and process.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
CHRDRV <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Character device driver name resolved by _/proc/devices_.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
COMMAND <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Command of the process opening the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
DELETED <__boolean__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Reachability from the file system.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
DEV <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
ID of the device containing the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
DEVTYPE <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Device type (_blk_, _char_, or _nodev_).
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
FD <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
File descriptor for the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
FLAGS <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Flags specified when opening the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
FUID <__number__>::
|
2021-10-12 06:42:37 +09:00
|
|
|
User ID number of the file's owner.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
INODE <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Inode number.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
MAJ:MIN <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Device ID for special, or ID of device containing file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
MAPLEN <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Length of file mapping (in page).
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
MISCDEV <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Misc character device name resolved by _/proc/misc_.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
MNTID <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Mount ID.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
MODE <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Access mode (rwx).
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
NAME <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Name of the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
NLINK <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Link count.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
OWNER <_string_>::
|
2021-10-12 06:42:37 +09:00
|
|
|
Owner of the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
PARTITION <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Block device name resolved by _/proc/partition_.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
PID <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
PID of the process opening the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
POS <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
File position.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
PROTONAME <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Protocol name.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
RDEV <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Device ID (if special file).
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
SIZE <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
File size.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
SOURCE <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
File system, partition, or device containing the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
TID <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
Thread ID of the process opening the file.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
TYPE <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
File type.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
UID <__number__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
User ID number.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
USER <__string__>::
|
2021-10-01 20:40:12 +02:00
|
|
|
User of the process.
|
|
|
|
|
2021-10-05 23:55:30 +09:00
|
|
|
== FILTER EXPRESSION
|
|
|
|
|
|
|
|
*lsfd* evaluates the expression passed to *--filter* option every time
|
|
|
|
before printing a file line. *lsfd* prints the line only if the result
|
|
|
|
of evaluation is _true_.
|
|
|
|
|
|
|
|
An expression consists of column names, literals and, operators like:
|
|
|
|
`DELETED`, `(PID == 1)`, `(NAME == "/etc/passwd")`, `(PID == 1) && DELETED`.
|
|
|
|
`DELETED`, `PID`, and `NAME` are column names in the example.
|
|
|
|
`1` and "/etc/passwd" are literals.
|
|
|
|
`==` and `&&` are operators.
|
|
|
|
|
|
|
|
Before evaluation, *lsfd* substitutes column names in the given
|
|
|
|
expression with actual column values in the line. There are three
|
|
|
|
different data types: _boolean_, _string_, and _number_. For columns
|
|
|
|
with a _boolean_ type, the vale can be stand-alone. For _string_ and
|
|
|
|
_number_ values, the value must be an operand of an operator, for
|
|
|
|
example, `(PID == 1)`. See the "OUTPUT COLUMNS" about the types of
|
|
|
|
columns.
|
|
|
|
|
|
|
|
Literal is for representing a value directly. See BOOLLIT, STRLIT, and
|
|
|
|
NUMLIT. Different data types have different literal syntax.
|
|
|
|
|
|
|
|
An operator works with one or two operand(s). An operator has an
|
|
|
|
expectation about the data type(s) of its operands. Giving an
|
|
|
|
unexpected data type to an operator causes a syntax error.
|
|
|
|
|
|
|
|
Operators taking two operands are _and_, _or_, _eq_, _ne_, _le_, _lt_, _ge_, _gt_, _=~_, _!~_.
|
|
|
|
Alphabetically named operators have C-language
|
|
|
|
flavored aliases: _&&_, _||_, _==_, _!=_, _<_, _<=_, _>=_, and _>_.
|
|
|
|
|
|
|
|
_!_ is the only operator that takes one operand.
|
|
|
|
|
|
|
|
_eq_, _ne_, and their aliases expect operands have the same data type.
|
|
|
|
Applying these operators return a _boolean_.
|
|
|
|
|
|
|
|
_and_, _or_, _not_ and their aliases expect operands have _bool_ data
|
|
|
|
type. Applying these operators return a _boolean_.
|
|
|
|
|
|
|
|
_lt_, _le_, _gt_, _ge_, and their aliases expect operands have
|
|
|
|
_number_ data types. Applying these operators return a _boolean_.
|
|
|
|
|
|
|
|
_=~_ is for regular expression matching; if a string at the right side
|
|
|
|
matches a regular expression at the left side, the result is true.
|
|
|
|
The right side operand must be a string literal. See STRLIT about the
|
|
|
|
syntax.
|
|
|
|
|
|
|
|
_!~_ is a short-hand version of `not (STR =~ PAT)`; it inverts the
|
|
|
|
result of _=~_.
|
|
|
|
|
|
|
|
=== Limitations
|
|
|
|
|
|
|
|
The current implementation does not define precedences within
|
|
|
|
operators. Use _(_ and _)_ explicitly for grouping the
|
|
|
|
sub-expressions if your expression uses more than two operators.
|
|
|
|
|
|
|
|
About _number_ typed values, the filter engine supports only
|
|
|
|
zero or positive numbers.
|
|
|
|
|
|
|
|
=== Semi-formal syntax
|
|
|
|
|
|
|
|
EXPR :: BOOLEXP
|
|
|
|
|
|
|
|
BOOLEXP0 :: COLUMN <__boolean__> | BOOLLIT | _(_ BOOLEXP _)_
|
|
|
|
|
|
|
|
BOOLEXP :: BOOLEXP0 | BOOLOP1 | BOOLOP2 | BOOLOP2BL | BOOLOP2CMP | BOOLOP2REG
|
|
|
|
|
|
|
|
COLUMN :: [\_A-Za-z][-_:A-Za-z0-9]*
|
|
|
|
|
|
|
|
BOOLOP1 :: _!_ BOOLEXP0 | _not_ BOOLEXP0
|
|
|
|
|
|
|
|
STREXP :: COLUMN <__string__> | STRLIT
|
|
|
|
|
|
|
|
NUMEXP :: COLUMN <__number__> | NUMLIT
|
|
|
|
|
|
|
|
BOOLLIT :: _true_ | _false_
|
|
|
|
|
|
|
|
CHARS :: ( [^\] | _\\_ | _\'_ | _\"_ )*
|
|
|
|
|
|
|
|
STRLIT :: _'_ CHARS _'_ | _"_ CHARS _"_
|
|
|
|
|
|
|
|
NUMLIT :: [1-9][0-9]* | _0_
|
|
|
|
|
|
|
|
BOOLOP2 :: STREXP OP2 STREXP | NUMEXP OP2 NUMEXP | BOOLEXP0 OP2 BOOLEXP0
|
|
|
|
|
|
|
|
OP2 :: _==_ | _eq_ | _!=_ | _ne_
|
|
|
|
|
|
|
|
BOOLOP2BL :: BOOLEXP0 OP2BL BOOLEXP0
|
|
|
|
|
|
|
|
OP2BL :: _&&_ | _and_ | _||_ | _or_
|
|
|
|
|
|
|
|
BOOLOP2CMP :: NUMEXP OP2CMP NUMEXP
|
|
|
|
|
|
|
|
OP2CMP :: _<_ | _lt_ | _\<=_ | _le_ | _>_ | _gt_ | _>=_ | _ge_
|
|
|
|
|
|
|
|
BOOLOP2REG :: STREXP OP2REG STRLIT
|
|
|
|
|
|
|
|
OP2REG :: _=~_ | _!~_
|
|
|
|
|
|
|
|
== EXAMPLES
|
|
|
|
|
|
|
|
List files associated with PID 1 and PID 2 processes::
|
|
|
|
|
|
|
|
# lsfd -Q '(PID == 1) or (PID == 2)'
|
|
|
|
|
|
|
|
Do the same in an alternative way::
|
|
|
|
|
|
|
|
# lsfd -Q '(PID == 1) || (PID == 2)'
|
|
|
|
|
|
|
|
List all running executables::
|
|
|
|
|
|
|
|
# lsfd -Q '(ASSOC == "exe")'
|
|
|
|
|
|
|
|
Do the same in an alternative way::
|
|
|
|
|
|
|
|
# lsfd -Q '(ASSOC eq "exe")'
|
|
|
|
|
|
|
|
Do the same but print only file names::
|
|
|
|
|
|
|
|
# lsfd -o NAME -Q '(ASSOC eq "exe")' | sort -u
|
|
|
|
|
|
|
|
List deleted non-regular files::
|
|
|
|
|
|
|
|
# lsfd -Q 'DELETED and (TYPE != "REG")'
|
|
|
|
|
|
|
|
List files including "dconf" directory in their names::
|
|
|
|
|
|
|
|
# lsfd -Q '(NAME =~ ".*/dconf/.*")
|
|
|
|
|
2021-10-01 20:40:12 +02:00
|
|
|
== HISTORY
|
|
|
|
|
|
|
|
The *lsfd* command is part of the util-linux package since v2.38.
|
|
|
|
|
|
|
|
== AUTHORS
|
|
|
|
|
2021-10-06 11:11:16 +02:00
|
|
|
mailto:yamato@redhat.com[Masatake YAMATO],
|
|
|
|
mailto:kzak@redhat.com[Karel Zak]
|
2021-10-01 20:40:12 +02:00
|
|
|
|
|
|
|
== SEE ALSO
|
|
|
|
|
|
|
|
*lsof*(8)
|
2021-10-04 03:57:06 +09:00
|
|
|
*proc*(5)
|
2021-10-01 20:40:12 +02:00
|
|
|
|
|
|
|
include::man-common/bugreports.adoc[]
|
|
|
|
|
|
|
|
include::man-common/footer.adoc[]
|
|
|
|
|
|
|
|
ifdef::translation[]
|
|
|
|
include::man-common/translation.adoc[]
|
|
|
|
endif::[]
|