How to check if a particular service is running on Ubuntu

前端 未结 13 1905
猫巷女王i
猫巷女王i 2021-01-29 17:48

I do not know the service\'s name, but would like to stop the service by checking its status.

For example, if I want to check if the PostgreSQL service is running or no

13条回答
  •  粉色の甜心
    2021-01-29 18:08

    For Ubuntu (checked with 12.04)

    You can get list of all services and select by color one of them with 'grep':

    sudo service --status-all | grep postgres
    

    Or you may use another way if you know correct name of service:

    sudo service postgresql status
    

提交回复
热议问题