From: Masatake YAMATO Date: Wed, 20 Oct 2021 14:22:28 +0000 (+0900) Subject: lsfd: (adoc) add more exapmles X-Git-Tag: v2.38-rc1~144^2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d112a40cb47e69e451dd9fefc1fe7c9747076546;p=thirdparty%2Futil-linux.git lsfd: (adoc) add more exapmles Signed-off-by: Masatake YAMATO --- diff --git a/misc-utils/lsfd.1.adoc b/misc-utils/lsfd.1.adoc index 8549c33553..eaa6e2ef52 100644 --- a/misc-utils/lsfd.1.adoc +++ b/misc-utils/lsfd.1.adoc @@ -265,6 +265,10 @@ OP2REG :: _=~_ | _!~_ == EXAMPLES +*lsfd* has few options for filtering. In most of cases, what you should +know is *-Q* (or *--filter*) option. Combined with *-o* (or +*--output*) option, you can customize the output as you want. + List files associated with PID 1 and PID 2 processes:: # lsfd -Q '(PID == 1) or (PID == 2)' @@ -273,6 +277,14 @@ Do the same in an alternative way:: # lsfd -Q '(PID == 1) || (PID == 2)' +List the 1st file descriptor opened by PID 1 process:: + + # lsfd -Q '(PID == 1) and (FD == 1)' + +Do the same in an alternative way:: + + # lsfd -Q '(PID == 1) && (FD == 1)' + List all running executables:: # lsfd -Q '(ASSOC == "exe")' @@ -285,13 +297,33 @@ Do the same but print only file names:: # lsfd -o NAME -Q '(ASSOC eq "exe")' | sort -u -List deleted non-regular files:: +List deleted files associated to processes:: + + # lsfd -Q 'DELETED' + +List non-regular files:: - # lsfd -Q 'DELETED and (TYPE != "REG")' + # lsfd -Q '(TYPE != "REG")' + +List block devices:: + + # lsfd -Q '(DEVTYPE == "blk")' + +Do the same with TYPE column:: + + # lsfd -Q '(TYPE == "BLK")' List files including "dconf" directory in their names:: - # lsfd -Q '(NAME =~ ".*/dconf/.*") + # lsfd -Q '(NAME =~ ".\*/dconf/.*") + +List files opened to QEMU virtual machine:: + + # lsfd -Q '(COMMAND =~ ".\*qemu.*") and (FD >= 0)' + +Hide files associated to kernel threads:: + + # lsfd -Q '!KTHREAD' == HISTORY