Coder Perfect

How can I see if a service I don’t recognise is running on Ubuntu?

Problem

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

Solution #1

I don’t have an Ubuntu machine, however you can check all running services on Red Hat Linux by typing the following command:

service --status-all

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

Solution #2

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

Solution #3

Perhaps the ps command is what you’re looking for.

ps -ef

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

Solution #4

There’s a quick way to see if a service is up and functioning.

systemctl status service_name

Try PostgreSQL:

systemctl status postgresql

Answered by Angel

Solution #5

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