Modern Linux distributions, including Ubuntu, rely on a system and service manager called systemd to control what software runs in the background. Whether you are running a web server (like Apache or Nginx), a database (like MySQL), or just standard system background processes, these are all classified as “services.” Knowing how to list and check the status of these services is a fundamental skill for any Linux user.
How to List All Active Services
The primary tool you will use to interact with systemd is the systemctl command. To see a list of all currently active (running) services on your Ubuntu machine, open your terminal and type:
systemctl list-units --type=service --state=active
What this command does:
list-units: Tells systemctl to list the system’s components.--type=service: Filters the list so it only shows services, hiding things like mount points and sockets.--state=active: Filters the list further to only show services that are currently turned on and running.
The output will display in a table format. Look at the UNIT column for the name of the service (e.g., nginx.service or ssh.service) and the DESCRIPTION column for a human-readable explanation of what the service does.
How to List ALL Services (Even the Dead Ones)
Sometimes you need to find a service that crashed, or one that is installed but currently turned off. To see every single service installed on your system, regardless of its current state, run:
systemctl list-units --type=service --all
Look at the ACTIVE and SUB columns. A healthy running service will say active (running). A service that is turned off will say inactive (dead), and a service that crashed will say failed (failed).
How to Check the Status of a Specific Service
If you already know the name of the service you want to check (for example, you want to see if your SSH server is running properly), you do not need to scroll through the massive master list. Use the status command instead.
systemctl status ssh.service
This command provides a wealth of information, including:
- Whether the service is active or failed.
- The exact time it was started.
- The Process ID (PID) it is running under.
- The last 10 lines of the service’s log file (which is incredibly helpful for diagnosing why a service failed to start).
Navigating the Output (The Pager)
When you run these commands, the output will likely be longer than your terminal window. Linux uses a “pager” program (usually ‘less’) to display the text.
- Use the Up and Down arrow keys to scroll line by line.
- Use the Spacebar to jump down a full page.
- Press the Q key to quit the list and return to your normal terminal prompt.
Conclusion
Mastering the systemctl command is the first step toward becoming a proficient Linux administrator. By listing and checking the status of services, you can quickly identify what is running on your server and diagnose problems the moment they occur.