Working With Systemd and Manage the units files

 Working With Systemd

Understanding Systemd

Systemd service is used to manage units. Units can be many things. One of the most important units type is service. Basically services are the processes that provides the specific functions in the system.

To see Units types in systemd


Understand systemd units location:

/usr/lib/systemd/system contain units files which is default that install by rpm packages.

/etc/systemd/system contains custom unit files that have been written by an  administrator.  You should never edit these files.


Managing Units through systemd

As an administrator to manages the systemd units to stop and start . Systemctl is the command to manage the services.

The systemctl command has a lot of options. Don't be overwhelmed to see all the option just use bash-completition option.


Systemd status overview

Status                                    Description

Loaded                                The unit/service file has been processed and the unit/service is active.

Active(running)                   The unit/service is running with one or more active processes.

Active(exited)                     The unit/service has successfully completed a one-time run.

Active(waiting)                  The unit/service is running and waiting for an event.

Inactive(dead)                    The unit/service is stop

Enabled                              The unit/service will be started at boot time. Its boot persistant.

Disabled                             The unit/service will not be started at boot time. 

Static                                  The unit/service cannot be enabled but may be started by another                                                                unit/service automatically


Managing Units with Systemctl

1. yum install httpd

2. systemctl start httpd

3. systemctl status httpd




4. systemctl --now enable httpd     
it start and enable the httpd service at the same time.



5. systemctl --now disable httpd         it stop and disable httpd service  at the same time




systemctl Unit Overview Command

1.systemctl list-unit-files  it list all unit files and their state


2. systemctl --type=service   
show only services


3. systemctl list-unit-types --type=service   show only services same result as previous commands


4. systemctl list-unit-types --type=service --state=enabled  show all enabled services


5.  systemctl list-unit-types --type=service --state=disabled






Comments