How to List Systemd Services in Linux

Systemd is an essential component of modern Linux systems, serving as the initialization and service management system. It replaces the traditional init system and offers several advanced features for maintaining secure, efficient, and reliable critical infrastructure and corporate networks.

Systemd Service Units

Systemd organizes services through unit files with an .service extension. These unit files contain instructions on how to start, stop, and manage a specific service.

They are usually located in :

/lib/systemd/system/
/etc/systemd/system/

Service States

Systemd categorizes services into states:

  • Active: Indicates that a service is currently running and operational.
  • Inactive: Signifies that a service is not running.
  • Failed: Denotes that a service attempted to start but encountered an issue.
  • Loaded: This shows that the service unit file is loaded into the Systemd system but may not be active. Monitoring service states is crucial for maintaining the integrity of critical systems.
# systemctl
systemctl list-units --type=service
systemctl list-units --type=service --state=active
systemctl list-units --type=service --state=running
firewall-cmd --list-services

Leave a Reply