Tuesday, September 9, 2014

[Quick Tips] : How to check all the currently running services in Linux



How to check all the currently running services in Linux
To find the status of any single service
# service vsftpd status
vsftpd (pid 5909) is running...

To get the status of all the running services
# 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...

In case you don't use grep you will be able to see all the services on your machine
# 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

You can also check the active ports along with their services using
# 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

No comments: