關於linux下沒有安裝某個命令時,可以用下面的命令進行搜尋:
yum whatprovides */lsof
yum -y install lsof
[root@zabbix scripts]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6461/sshd
tcp 0 0 :::22 :::* LISTEN 6461/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 5586/dhclient
[root@zabbix scripts]# lsof -p 6461
lsof -p pid:顯示程式開啟的所有檔案
[root@zabbix scripts]# lsof /usr/sbin/sshd 檢視所有開啟了檔案/usr/sbin/sshd的程式
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 6461 root txt REG 8,3 526008 659271 /usr/sbin/sshd
sshd 49889 root txt REG 8,3 526008 659271 /usr/sbin/sshd