I’m not sure what the service’s name is, but I’d like to stop it by checking its status.
For instance, if I want to see if the PostgreSQL service is up and running but don’t know the service’s name, how can I do so?
If the service name is known, I know the command to check the status.
Asked by abcd
I don’t have an Ubuntu machine, however you can check all running services on Red Hat Linux by typing the following command:
The + indicates that the service is active, the – indicates that it is not active, and the? indicates that the service state cannot be determined.
Answered by Radu
In the case of Ubuntu (checked with 12.04)
With ‘grep,’ you can get a list of all services and choose one by color:
sudo service --status-all | grep postgres
If you know the correct name of the service, you can use another method:
sudo service postgresql status
Answered by zhecsan
Perhaps the ps command is what you’re looking for.
will show you all the processes that are currently active. Then, assuming you know what you’re looking for, use grep to filter the results;
ps -ef | grep postgres
Answered by Mike Makuch
There’s a quick way to see if a service is up and functioning.
systemctl status service_name
systemctl status postgresql
Answered by Angel
You may acquire a list of services by using the following command:
sudo service --status-all
Run the following command to receive a list of upstart jobs:
sudo initctl list
Answered by linuxnewbee
Post is based on https://stackoverflow.com/questions/18721149/how-to-check-if-a-service-that-i-dont-know-the-name-of-is-running-on-ubuntu