查找任何单个服务的状态
# service vsftpd status vsftpd (pid 5909) is running...
获取所有正在运行的服务的状态
# service --status-all | grep running acpid (pid 5310) is running... atd (pid 6528) is running... auditd (pid 5012) is running... Avahi daemon is not running Avahi DNS daemon is not running The Pegasus CIM Listener is running. The Pegasus CIM Object Manager is running. crond (pid 6242) is running... dcerpcd (pid 5177) is running... eventlogd (pid 5223) is running...
如果我们不使用 grep,我们将能够看到我们机器上的所有服务
# service --status-all NetworkManager is stopped acpid (pid 5310) is running... anacron is stopped atd (pid 6528) is running... auditd (pid 5012) is running... automount is stopped Avahi daemon is not running Avahi DNS daemon is not running hcid is stopped sdpd is stopped
我们还可以使用以下命令检查活动端口及其服务
# netstat -ntlp 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:52961 0.0.0.0:* LISTEN 5223/eventlogd tcp 0 0 0.0.0.0:5988 0.0.0.0:* LISTEN 6116/cimserver tcp 0 0 0.0.0.0:5989 0.0.0.0:* LISTEN 6116/cimserver tcp 0 0 0.0.0.0:678 0.0.0.0:* LISTEN 5160/rpc.statd tcp 0 0 0.0.0.0:14247 0.0.0.0:* LISTEN 6460/java tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 5857/snmpd tcp 0 0 0.0.0.0:135 0.0.0.0:* LISTEN 5177/dcerpcd
日期:2020-06-02 22:18:24 来源:oir作者:oir