Skip to main content

Command Palette

Search for a command to run...

How to List the Services in Linux

Published
5 min readView as Markdown

Listing services in Linux is a common task for anyone managing or using a Linux system. Whether you want to check which services are running, enabled, or stopped, knowing how to list them helps you understand your system better. In this article, I’ll guide you through the most popular and reliable methods to list services on Linux.

You’ll see commands that work on different Linux distributions and learn how to interpret their output. By the end, you’ll feel confident managing services and troubleshooting your Linux system with ease.

Understanding Linux Services

Linux services are background processes that perform specific tasks, like running a web server or managing network connections. These services are often called daemons. They start automatically when your system boots or can be started manually.

Services are managed by different init systems depending on your Linux distribution. The two most common are:

  • Systemd: Used by most modern Linux distros like Ubuntu, Fedora, and Debian.
  • SysVinit: Older system still used in some distributions.

Knowing which init system your Linux uses helps you choose the right commands to list services.

Listing Services with systemd

Most Linux systems today use systemd to manage services. It provides a powerful tool called systemctl to control and list services.

Basic Commands to List Services

To list all services on your system, open a terminal and type:

systemctl list-units --type=service

This command shows all loaded service units, their status, and whether they are active or inactive.

If you want to see all services, including those not currently loaded, use:

systemctl list-unit-files --type=service

This lists all service files and their enablement status (enabled, disabled, static).

Filtering Services by Status

You can filter services by their state:

  • To see only active (running) services:

    systemctl list-units --type=service --state=running
    
  • To see failed services:

    systemctl --failed
    

Understanding the Output

The output columns include:

  • UNIT: The service name.
  • LOAD: Whether the service file is loaded.
  • ACTIVE: The high-level state (active, inactive).
  • SUB: More detailed state (running, exited).
  • DESCRIPTION: A short description of the service.

Examples of Common Services

You might see services like:

  • ssh.service – Secure Shell server.
  • cron.service – Job scheduler.
  • network.service or NetworkManager.service – Network management.

Listing Services with SysVinit

If your Linux system uses the older SysVinit system, you’ll use different commands.

Using service Command

To list all services, run:

service --status-all

This command shows a list of services with symbols indicating their status:

  • [ + ] means the service is running.
  • [ - ] means the service is stopped.
  • [ ? ] means the status is unknown.

Using chkconfig (Red Hat-based Systems)

On some Red Hat-based systems, you can use:

chkconfig --list

This lists services and their runlevel settings, showing which services start automatically.

Using /etc/init.d/

You can also check the /etc/init.d/ directory, which contains scripts for services. Listing the files here shows available services:

ls /etc/init.d/

Using ps and top to See Running Services

Sometimes, you want to see which services or daemons are currently running as processes.

  • Use ps to list processes:

    ps aux | grep -i service-name
    
  • Use top or htop for a real-time view of running processes.

This method shows active services but doesn’t provide enablement status.

Checking Service Status with GUI Tools

If you prefer graphical interfaces, many Linux desktop environments offer tools to manage services.

  • GNOME System Monitor: Shows running processes.
  • KDE System Settings: Has a module for managing services.
  • Third-party tools: Applications like systemd-manager provide GUI for systemd services.

These tools are user-friendly for beginners but may not show all service details.

Tips for Managing Services

Knowing how to list services is just the start. Here are some tips to manage them effectively:

  • Use systemctl start service-name to start a service.
  • Use systemctl stop service-name to stop a service.
  • Use systemctl enable service-name to start a service at boot.
  • Use systemctl disable service-name to prevent a service from starting automatically.

Always check the service status after changes with:

systemctl status service-name

Summary Table of Commands

Init SystemCommand to List ServicesNotes
systemdsystemctl list-units --type=serviceLists active and inactive services
systemdsystemctl list-unit-files --type=serviceLists all service files and enablement
SysVinitservice --status-allLists services with status symbols
SysVinitchkconfig --listShows services and runlevels (Red Hat)
SysVinitls /etc/init.d/Lists service scripts

Conclusion

Listing services in Linux is a straightforward task once you know which commands to use. Whether your system uses systemd or SysVinit, you have reliable tools to see which services are running, enabled, or stopped. This knowledge helps you maintain your system’s health and troubleshoot issues quickly.

I encourage you to try these commands on your Linux machine. Start by listing all services, then check their status and enablement. With practice, managing Linux services will become second nature, making your system administration smoother and more efficient.

FAQs

How do I know if my Linux uses systemd or SysVinit?

You can check by running pidof systemd. If it returns a process ID, your system uses systemd. Otherwise, it likely uses SysVinit.

Can I list services without root privileges?

Listing services usually requires root or sudo access for full details. Some commands may show limited info without elevated permissions.

What is the difference between active and enabled services?

Active services are currently running. Enabled services are set to start automatically at boot, whether they are running now or not.

How do I list only failed services?

Use systemctl --failed to see services that failed to start or crashed.

Can I list services on remote Linux machines?

Yes, by using SSH to connect remotely and running the same commands, you can list services on remote Linux systems.

More from this blog

L

LinuxBloke | Linux Tips, Tricks & Troubleshooting

672 posts