0

Check which files are opened by the program

neo created at2 months ago view count: 18
lsof -p $(pidof -s systemd)
systemd 2594 root  txt       REG              254,0  1739200   28577792 /usr/lib/systemd/systemd
systemd 2594 root  mem       REG              254,0   149576   28574681 /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
systemd 2594 root  mem       REG              254,0  3076960   28573725 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
systemd 2594 root  mem       REG              254,0    26984   28574568 /usr/lib/x86_64-linux-gnu/libcap-ng.so.0.0.0
systemd 2594 root  DEL       REG              254,0            28575891 /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
systemd 2594 root  mem       REG              254,0   149520   28574409 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
systemd 2594 root  mem       REG              254,0    18688   28574396 /usr/lib/x86_64-linux-gnu/libdl-2.31.so
systemd 2594 root  mem       REG              254,0   158400   28574079 /usr/lib/x86_64-linux-gnu/liblzma.so.5.2.5
systemd 2594 root  mem       REG              254,0   890800   28574008 /usr/lib/x86_64-linux-gnu/libzstd.so.1.4.8
systemd 2594 root  mem       REG              254,0   137568   28574718 /usr/lib/x86_64-linux-gnu/liblz4.so.1.9.3
systemd 2594 root  mem       REG              254,0    35280   28577619 /usr/lib/x86_64-linux-gnu/libip4tc.so.2.0.0
systemd 2594 root  mem       REG              254,0  1176248   28574693 /usr/lib/x86_64-linux-gnu/libgcrypt.so.20.2.8
systemd 2594 root  mem       REG              254,0   202680   28573709 /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
systemd 2594 root  mem       REG              254,0    38864   28577608 /usr/lib/x86_64-linux-gnu/libcap.so.2.44
systemd 2594 root  mem       REG              254,0   326624   28575507 /usr/lib/x86_64-linux-gnu/libblkid.so.1.1.0
systemd 2594 root  mem       REG              254,0    38936   28574106 /usr/lib/x86_64-linux-gnu/libacl.so.1.1.2253
systemd 2594 root  mem       REG              254,0  1839792   28573722 /usr/lib/x86_64-linux-gnu/libc-2.31.so
systemd 2594 root  mem       REG              254,0    76480   28577610 /usr/lib/x86_64-linux-gnu/libapparmor.so.1.6.3
systemd 2594 root  mem       REG              254,0   108592   28577621 /usr/lib/x86_64-linux-gnu/libkmod.so.2.3.6
systemd 2594 root  mem       REG              254,0   128952   28574575 /usr/lib/x86_64-linux-gnu/libaudit.so.1.0.0
systemd 2594 root  mem       REG              254,0    67584   28573740 /usr/lib/x86_64-linux-gnu/libpam.so.0.85.1
systemd 2594 root  mem       REG              254,0   375424   28575862 /usr/lib/x86_64-linux-gnu/libmount.so.1.1.0
systemd 2594 root  mem       REG              254,0   166120   28575899 /usr/lib/x86_64-linux-gnu/libselinux.so.1
systemd 2594 root  mem       REG              254,0   137536   28574795 /usr/lib/x86_64-linux-gnu/libseccomp.so.2.5.1
systemd 2594 root  mem       REG              254,0    39912   28574412 /usr/lib/x86_64-linux-gnu/librt-2.31.so
systemd 2594 root  mem       REG              254,0  2692512   28577641 /usr/lib/systemd/libsystemd-shared-247.so
systemd 2594 root  mem       REG              254,0   177928   28573717 /usr/lib/x86_64-linux-gnu/ld-2.31.so
systemd 2594 root    0r      CHR                1,3      0t0          4 /dev/null
systemd 2594 root    1u     unix 0x00000000190acce2      0t0      22960 type=STREAM
systemd 2594 root    2u     unix 0x00000000190acce2      0t0      22960 type=STREAM
systemd 2594 root    3u     unix 0x0000000025b514fc      0t0      22979 type=DGRAM
systemd 2594 root    4u  a_inode               0,13        0       9065 [eventpoll]
systemd 2594 root    5u  a_inode               0,13        0       9065 [signalfd]
systemd 2594 root    6r  a_inode               0,13        0       9065 inotify
systemd 2594 root    7r      DIR               0,28        0       9234 /sys/fs/cgroup/user.slice/user-0.slice/user@0.service
systemd 2594 root    8u  a_inode               0,13        0       9065 [timerfd]
systemd 2594 root    9u  a_inode               0,13        0       9065 [eventpoll]
systemd 2594 root   10r      REG               0,21        0      23002 /proc/2594/mountinfo
systemd 2594 root   11r  a_inode               0,13        0       9065 inotify
systemd 2594 root   12u     unix 0x0000000042e0087e      0t0      23016 /run/user/0/bus type=STREAM
systemd 2594 root   13r  a_inode               0,13        0       9065 inotify
systemd 2594 root   14r      REG               0,21        0 4026532085 /proc/swaps
systemd 2594 root   15u  netlink                         0t0      23003 KOBJECT_UEVENT
systemd 2594 root   16u     unix 0x000000006a60956b      0t0      23007 /run/user/0/systemd/notify type=DGRAM
systemd 2594 root   17u     unix 0x00000000aefe9498      0t0      23008 type=DGRAM
systemd 2594 root   18u     unix 0x000000007ebccb44      0t0      23009 type=DGRAM
systemd 2594 root   19u     unix 0x00000000ce35dc18      0t0      23010 /run/user/0/systemd/private type=STREAM
systemd 2594 root   20u     unix 0x0000000037072b9c      0t0      23012 type=STREAM
systemd 2594 root   21u  a_inode               0,13        0       9065 [timerfd]
systemd 2594 root   26u     unix 0x00000000ec880f22      0t0      23018 /run/user/0/gnupg/S.dirmngr type=STREAM
systemd 2594 root   27u     unix 0x00000000ad9ccd83      0t0      23020 /run/user/0/gnupg/S.gpg-agent.browser type=STREAM
systemd 2594 root   28u     unix 0x00000000bb03707f      0t0      23022 /run/user/0/gnupg/S.gpg-agent.extra type=STREAM
systemd 2594 root   29u     unix 0x000000006f917334      0t0      23024 /run/user/0/gnupg/S.gpg-agent.ssh type=STREAM
systemd 2594 root   30u     unix 0x000000003e44798e      0t0      23026 /run/user/0/gnupg/S.gpg-agent type=STREAM
systemd 2594 root   31u     unix 0x00000000ddbfe82b      0t0      23028 /run/user/0/pk-debconf-socket type=STREAM

lsof

Lsof revision 4.93.2 lists on its standard output file information about files opened by processes for the following UNIX dialects:

Apple Darwin 9 and Mac OS X 10.[567] FreeBSD 8.[234], 9.0 and 1[012].0 for AMD64-based systems Linux 2.1.72 and above for x86-based systems Solaris 9, 10 and 11

(See the DISTRIBUTION section of this manual page for information on how to obtain the latest lsof revision.)

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.

Instead of a formatted display, lsof will produce output that can be parsed by other programs. See the -F, option description, and the OUTPUT FOR OTHER PROGRAMS section for more information.

In addition to producing a single output list, 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 +|-r [t[m<fmt>]] option description for more information.  

pidof

Pidof finds the process id's (PIDs) of the named programs. It prints those id's on the standard output. This program is on some systems used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead.  
report

Comments

search keywords

Recent search keywords