1. Introduction

Systemd is a widely used system and service manager in Linux, but not all Linux distributions use it. Some distributions, such as Debian and Ubuntu, still use the traditional SysVinit or Upstart systems for managing services.

In this article, we’ll cover the different methods for checking the running services on non-systemd Linux machines.

2. ps Command

The ps (process status) command displays information about the currently running processes on a Linux system. Let’s see how to check the services running on a non-systemd Linux machine:

$ ps aux | grep [s]ervice_name
root 11545 0.0 0.0 14012 4116 ? Ss 13:30 0:00 /usr/sbin/sshd -D

The output of the ps aux command shows the process ID (PID), user, status, and command line for each process. In this example, the service name is sshd, and its process ID is 11545. The Ss status code in the status column indicates that the process is running and is a system service. The ps aux option displays all running processes, while the grep [s]ervice_name filters the output to only show the service with the specified name. The [s]in [s]ervice_name is used to exclude the grep process itself from the output.

The aux options stand for:

  • a – display processes for all users
  • u – display the process’s user/owner
  • x – also display processes not attached to a terminal

This command is useful for quickly checking if a specific service is running or not.

3. top Command

The top command is a real-time process monitoring utility that displays information about the system’s processes. To see the services running on a non-systemd Linux machine, let’s run:

$ top
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
11545 root      20   0  14012   4116   1184 S   0.0  0.0   0:00.00 sshd

Once top is running, press the C key to show the command line for each process. We can search for the service name to see if it’s running. The top command provides a dynamic view of the processes running on a system, updating the information in real time.

The output of the top command shows the process ID, user, priority, virtual memory, resident memory, shared memory, status, CPU usage, memory usage, and command line for each process. In this example, the service name is sshd, and its process ID is 11545. The S status code in the status column indicates that the process is sleeping.

4. service Command

The service command controls system services in SysVinit and Upstart systems. To see the status of a specific service, we can run:

$ service ssh.service status
ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/etc/rc.d/ssh)
Active: active (running) since Mon 2020-01-06 09:07:24 PST; 2 weeks 4 days ago

The output of the service command shows the name of the service, its load status, active status, and start time.

In this example, the service name is ssh.service, and it is loaded and active (running). Knowing the service’s start time can be useful for troubleshooting and monitoring.

5. Conclusion

There are several methods for checking running services on non-systemd Linux machines. The ps and top commands provide real-time process information, while the service command provides a way to manage and check the status of services in SysVinit and Upstart systems.

Understanding these methods will help us effectively monitor and manage the services running on our non-systemd Linux machine.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.