{"id":27477,"date":"2018-07-19T04:57:02","date_gmt":"2018-07-19T09:57:02","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=27477"},"modified":"2022-06-03T03:34:48","modified_gmt":"2022-06-03T08:34:48","slug":"how-to-list-all-services-in-linux","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-list-all-services-in-linux\/","title":{"rendered":"How to List All Running Services in Linux"},"content":{"rendered":"
Linux-based operating systems, like all other operating systems, have processes and services that run while the machine is on. These range from various operating system services, to the command line, to different services\/daemons designed to maintain the system and keep it running smoothly. Most services are vital to a process’ normal operation, ranging from helper services to special services designed to handle input, improve performance, offload resources, etc. Processes are also the backbone of a computer’s core functionality, making it important to have the resources for them all. <\/p>\r\n\r\n\r\n\r\n
<\/p>\r\n\r\n\r\n\r\n
However, it may occur that a service can run without your knowledge, use up system resources, and even make your system vulnerable if security measures have not been taken into account. Because of possible cases like these, it’s good to know how to check and deal with such cases, as well as have the ability to monitor what processes and services are running on your machine at any moment.<\/p>\r\n\r\n\r\n\r\n
In this tutorial, we will go through several methods of listing\/showing all running services and processes on a Linux-based server<\/a> or machine, as well as go through some useful commands that will help you find and manage these processes and services.<\/p>\r\n\r\n\r\n\r\n The ‘service’ command comes pre-installed with almost every Linux distribution out there. While its main purpose is to start and stop scripts and create processes, ‘service’ can also be used to see what services are running or stopped at any given moment. Using a simple command, we are given a complete list of services:<\/p>\r\n\r\n\r\n\r\n When you run this, an output similar to this will appear:<\/p>\r\n\r\n\r\n\r\n As you can see, a list of services is given as output, with a symbol to the left of the service’s name. A ‘+’ symbol means the service is running, a ‘-‘ means that it is stopped, and a ‘?’ means that the status is not currently known. When this is used in combination with a search tool such as ‘grep’, finding specific services that are running is very easy to do. You can then check the status on a process-by-process basis by entering the status command for a specific process:<\/p>\r\n\r\n\r\n\r\n This will then output a set of information pertaining to that specific service, including the location of the process, whether or not the service is running, and even the last few lines of the log file from the service.<\/p>\r\n\r\n\r\n\r\n Short for ‘process status’, PS is a pre-installed utility designed to display information and details about processes. It is a simple, fast tool designed to give quick results with no fuss. With one simple command, we can list a well-detailed list of currently running processes:<\/p>\r\n\r\n\r\n\r\n ps -aux<\/p>\r\n\r\n\r\n\r\n You can use this in conjunction with the ‘less’ command to further improve readability. When running this command, we are given details for each process currently running. You can also use the ‘grep’ command to narrow down the results to a specific process name, process ID, and so on.<\/p>\r\n\r\n\r\n\r\nThe ‘service’ command line tool<\/h3>\r\n\r\n\r\n\r\n
service --status-all<\/pre>\r\n\r\n\r\n\r\n
[ + ] apache-htcacheclean\r\n[ + ] apache2\r\n[ + ] apparmor\r\n[ + ] bind9\r\n[ - ] bluetooth\r\n[ - ] bootmisc.sh\r\n[ - ] cgmanager\r\n[ - ] cgproxy\r\n[ - ] checkfs.sh\r\n[ - ] checkroot-bootclean.sh\r\n[ - ] checkroot.sh\r\n(continued)<\/pre>\r\n\r\n\r\n\r\n
<\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n
service <service name> status<\/pre>\r\n\r\n\r\n\r\n
PS<\/h3>\r\n\r\n\r\n\r\n
The ‘top’ command line tool<\/strong><\/h3>\r\n\r\n\r\n\r\n