출력 전체 명령 이름을 사용할 수 있습니까 lsof -nP -i4UDP
?
매뉴얼에서 (아래 참조)와 같은 적합한 옵션을 찾고 있었지만 -V
전체 이름이 생성되지 않습니다 COMMAND
. 즉, systemd-resolve
다음과 같이 나타납니다 systemd-r
.
$ sudo lsof -V -nP -i4UDP
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
avahi-dae 437 avahi 12u IPv4 12982 0t0 UDP *:5353
avahi-dae 437 avahi 14u IPv4 12984 0t0 UDP *:45006
cups-brow 449 root 7u IPv4 12149 0t0 UDP *:631
systemd-r 485 systemd-resolve 12u IPv4 14694 0t0 UDP 127.0.0.53:53
systemd-r 485 systemd-resolve 13u IPv4 14695 0t0 UDP *:5355
dhclient 629 root 6u IPv4 14985 0t0 UDP *:68
minissdpd 1186 root 4u IPv4 19639 0t0 UDP *:1900
답변1
에서 man lsof
:
+c w 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 lsof default is nine.) Note that many UNIX dialects do not supply all command name characters to lsof in the files and structures from which 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. If w is zero ('0'), all command characters supplied to lsof by the UNIX dialect will be printed. If w is less than the length of the column title, ``COMMAND'', it will be raised to that length.
이를 고려하여 +c0
모든 것을 사용 가능하도록 추가할 수 있습니다.
$ sudo lsof -V -nP -i4UDP +c0
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd-resolve 176 systemd-resolve 11u IPv4 11204 0t0 UDP *:5355