关于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