A simple way to view and turn off Linux system services

Time:2021-8-1

The essence of server is to provide access functions for various services. Make the server run only the required services and close the unused services. This will not only free up some system resources, but also make the server more secure. For example, if you just run a simple server, you obviously don’t need an X display or desktop environment. If you don’t need windows network sharing, you can safely turn off samba.

Use the following command to view the services started with the system startup:

   

Copy code

The code is as follows:

chkconfig –list | grep “3:on”

If the system is running SYSTEMd, execute this command:

   

Copy code

The code is as follows:

systemctl list-unit-files –type=service | grep enabled

Then shut down the service using the following command:

   

Copy code

The code is as follows:

chkconfig service off

    or
   

Copy code

The code is as follows:

systemctl disable service

In the above example, replace “service” with the name of the service you really want to stop. Examples are as follows:

   

Copy code

The code is as follows:

chkconfig httpd off

    or
   

Copy code

The code is as follows:

systemctl disable httpd