Systemctl : RHEL 7: How to check, start, stop, and manage units/services ?

Today we will look various systemctl commands to check units/services, start/stop/restart them.

In short how to play/work with systemctl commands to manage services/units.

1. How to see all units loaded on to the system.

[root@host-1-89 ~]# systemctl
  UNIT                                                       LOAD   ACTIVE SUB       DESCRIPTION
  proc-sys-fs-binfmt_misc.automount                          loaded active waiting   Arbitrary Executable File Formats File System Automount Po
  sys-devices-pci0000:00-0000:00:03.0-net-ens3.device        loaded active plugged   82540EM Gigabit Ethernet Controller (QEMU Virtual Machine)
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:0-1:0:0:0-block-sda-sda1.device loaded active plugged   QEMU_HARDDISK 1
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:0-1:0:0:0-block-sda-sda2.device loaded active plugged   LVM PV kIogiH-f548-AELA-N
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:0-1:0:0:0-block-sda.device loaded active plugged   QEMU_HARDDISK
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:1-1:0:1:0-block-sdb-sdb1.device loaded active plugged   QEMU_HARDDISK 1
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:1-1:0:1:0-block-sdb.device loaded active plugged   QEMU_HARDDISK
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:2-1:0:2:0-block-sr0.device loaded active plugged   QEMU_CD-ROM
  sys-devices-platform-serial8250-tty-ttyS1.device           loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS1
  sys-devices-platform-serial8250-tty-ttyS2.device           loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS2
  sys-devices-platform-serial8250-tty-ttyS3.device           loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS3
  sys-devices-pnp0-00:05-tty-ttyS0.device                    loaded active plugged   /sys/devices/pnp0/00:05/tty/ttyS0
  sys-devices-virtual-block-dm\x2d0.device                   loaded active plugged   /sys/devices/virtual/block/dm-0
  sys-devices-virtual-net-virbr0.device                      loaded active plugged   /sys/devices/virtual/net/virbr0
  sys-devices-virtual-net-virbr0\x2dnic.device               loaded active plugged   /sys/devices/virtual/net/virbr0-nic
  sys-module-configfs.device                                 loaded active plugged   /sys/module/configfs
  sys-subsystem-net-devices-ens3.device                      loaded active plugged   82540EM Gigabit Ethernet Controller (QEMU Virtual Machine)
  sys-subsystem-net-devices-virbr0.device                    loaded active plugged   /sys/subsystem/net/devices/virbr0
  sys-subsystem-net-devices-virbr0\x2dnic.device             loaded active plugged   /sys/subsystem/net/devices/virbr0-nic
  -.mount                                                    loaded active mounted   /
  boot.mount                                                 loaded active mounted   /boot
  dev-hugepages.mount                                        loaded active mounted   Huge Pages File System
  dev-mqueue.mount                                           loaded active mounted   POSIX Message Queue File System
  proc-fs-nfsd.mount                                         loaded active mounted   NFSD configuration filesystem
  run-user-0.mount                                           loaded active mounted   /run/user/0
  run-user-42.mount                                          loaded active mounted   /run/user/42
  sys-kernel-config.mount                                    loaded active mounted   Configuration File System
  sys-kernel-debug.mount                                     loaded active mounted   Debug File System
  var-lib-nfs-rpc_pipefs.mount                               loaded active mounted   RPC Pipe File System
  brandbot.path                                              loaded active waiting   Flexible branding
  cups.path                                                  loaded active waiting   CUPS Printer Service Spool
  systemd-ask-password-plymouth.path                         loaded active waiting   Forward Password Requests to Plymouth Directory Watch
  systemd-ask-password-wall.path                             loaded active waiting   Forward Password Requests to Wall Directory Watch
  session-1.scope                                            loaded active running   Session 1 of user root
  session-c1.scope                                           loaded active running   Session c1 of user gdm
  abrt-ccpp.service                                          loaded active exited    Install ABRT coredump hook
  abrt-oops.service                                          loaded active running   ABRT kernel log watcher
  abrt-xorg.service                                          loaded active running   ABRT Xorg log watcher
  abrtd.service                                              loaded active running   ABRT Automated Bug Reporting Tool
  accounts-daemon.service                                    loaded active running   Accounts Service
  acpid.service                                              loaded active running   ACPI Event Daemon
  alsa-state.service                                         loaded active running   Manage Sound Card State (restore and store)
  atd.service                                                loaded active running   Job spooling tools
  auditd.service                                             loaded active running   Security Auditing Service
  avahi-daemon.service                                       loaded active running   Avahi mDNS/DNS-SD Stack
  blk-availability.service                                   loaded active exited    Availability of block devices
  chronyd.service                                            loaded active running   NTP client/server
  colord.service                                             loaded active running   Manage, Install and Generate Color Profiles
  dbus.service                                               loaded active running   D-Bus System Message Bus
  gdm.service                                                loaded active running   GNOME Display Manager
  user-0.slice                                               loaded active active    user-0.slice
  user-42.slice                                              loaded active active    user-42.slice
  user.slice                                                 loaded active active    User and Session Slice
  avahi-daemon.socket                                        loaded active running   Avahi mDNS/DNS-SD Stack Activation Socket
  cups.socket                                                loaded active listening CUPS Printing Service Sockets
  dbus.socket                                                loaded active running   D-Bus System Message Bus Socket
  dm-event.socket                                            loaded active listening Device-mapper event daemon FIFOs
  iscsid.socket                                              loaded active listening Open-iSCSI iscsid Socket
  iscsiuio.socket                                            loaded active listening Open-iSCSI iscsiuio Socket
  lvm2-lvmetad.socket                                        loaded active running   LVM2 metadata daemon socket
  lvm2-lvmpolld.socket                                       loaded active listening LVM2 poll daemon socket
  rpcbind.socket                                             loaded active running   RPCbind Server Activation Socket
  systemd-initctl.socket                                     loaded active listening /dev/initctl Compatibility Named Pipe
  systemd-journald.socket                                    loaded active running   Journal Socket
  systemd-shutdownd.socket                                   loaded active listening Delayed Shutdown Socket
  systemd-udevd-control.socket                               loaded active running   udev Control Socket
  systemd-udevd-kernel.socket                                loaded active running   udev Kernel Socket
  telnet.socket                                              loaded active listening Telnet Server Activation Socket
  virtlogd.socket                                            loaded active listening Virtual machine log manager socket
  dev-disk-by\x2duuid-971d09b6\x2d8ce8\x2d49c7\x2d9ec9\x2d16b0155f42cf.swap loaded active active    /dev/disk/by-uuid/971d09b6-8ce8-49c7-9ec9-1
  basic.target                                               loaded active active    Basic System
  cryptsetup.target                                          loaded active active    Encrypted Volumes
  getty.target                                               loaded active active    Login Prompts
  graphical.target                                           loaded active active    Graphical Interface
  local-fs-pre.target                                        loaded active active    Local File Systems (Pre)
  local-fs.target                                            loaded active active    Local File Systems
  paths.target                                               loaded active active    Paths
  remote-fs-pre.target                                       loaded active active    Remote File Systems (Pre)
  remote-fs.target                                           loaded active active    Remote File Systems
  rpcbind.target                                             loaded active active    RPC Port Mapper
  slices.target                                              loaded active active    Slices
  sockets.target                                             loaded active active    Sockets
  swap.target                                                loaded active active    Swap
  sysinit.target                                             loaded active active    System Initialization
  timers.target                                              loaded active active    Timers
  systemd-tmpfiles-clean.timer                               loaded active waiting   Daily Cleanup of Temporary Directories

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

152 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
lines 129-160/160 (END)

 

2. What is the difference between systemctl and “systemctl list-units”
There is no difference between them.
Both commands displays all the units loaded on to the system.

root@host-1-89 ~]# systemctl | wc -l
160

[root@host-1-89 ~]# systemctl list-units | wc -l
160
[root@host-1-89 ~]#

 

3. See all system services including the ones disabled/inactive.

[root@host-1-89 ~]# systemctl --all
  UNIT                                                      LOAD      ACTIVE   SUB       DESCRIPTION
  proc-sys-fs-binfmt_misc.automount                         loaded    active   waiting   Arbitrary Executable File Formats File System Automoun
  dev-block-8:2.device                                      loaded    active   plugged   LVM PV kIogiH-f548-AELA-NMVK-sbr7-9u7j-2K6MDz on /dev/
  dev-cdrom.device                                          loaded    active   plugged   QEMU_CD-ROM
  dev-centos_lvm-root.device                                loaded    active   plugged   /dev/centos_lvm/root
  dev-disk-by\x2did-dm\x2dname\x2dcentos_lvm\x2droot.device loaded    active   plugged   /dev/disk/by-id/dm-name-centos_lvm-root
  dev-disk-by\x2did-dm\x2duuid\x2dLVM\x2dqGpE995l8Lvs0XM4Zz0FDUO5sY5Qm6P5xnNIQ2ct1mUqaRBkjOGrNIFUwte2ciYM.device loaded    active   plugged   /
  dev-disk-by\x2did-lvm\x2dpv\x2duuid\x2dkIogiH\x2df548\x2dAELA\x2dNMVK\x2dsbr7\x2d9u7j\x2d2K6MDz.device loaded    active   plugged   LVM PV kI
  dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_CD\x2dROM_cdrom2.device loaded    active   plugged   QEMU_CD-ROM
  dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_disk0.device loaded    active   plugged   QEMU_HARDDISK
  dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_disk0\x2dpart1.device loaded    active   plugged   QEMU_HARDDISK 1
  dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_disk0\x2dpart2.device loaded    active   plugged   LVM PV kIogiH-f548-AELA-NMVK-sbr7-9u7j-2K6MD
  dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_disk1.device loaded    active   plugged   QEMU_HARDDISK
  dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_disk1\x2dpart1.device loaded    active   plugged   QEMU_HARDDISK 1
  dev-disk-by\x2dpath-virtio\x2dpci\x2d0000:00:04.0\x2dscsi\x2d0:0:0:0.device loaded    active   plugged   QEMU_HARDDISK
  dev-disk-by\x2dpath-virtio\x2dpci\x2d0000:00:04.0\x2dscsi\x2d0:0:0:0\x2dpart1.device loaded    active   plugged   QEMU_HARDDISK 1
  dev-mapper-centos_lvm\x2droot.device                      loaded    active   plugged   /dev/mapper/centos_lvm-root
  dev-sda.device                                            loaded    active   plugged   QEMU_HARDDISK
  dev-sda1.device                                           loaded    active   plugged   QEMU_HARDDISK 1
  dev-sda2.device                                           loaded    active   plugged   LVM PV kIogiH-f548-AELA-NMVK-sbr7-9u7j-2K6MDz on /dev/
  dev-sdb.device                                            loaded    active   plugged   QEMU_HARDDISK
  dev-sdb1.device                                           loaded    active   plugged   QEMU_HARDDISK 1
  dev-sr0.device                                            loaded    active   plugged   QEMU_CD-ROM
  dev-ttyS0.device                                          loaded    active   plugged   /dev/ttyS0
  dev-ttyS1.device                                          loaded    active   plugged   /dev/ttyS1
  dev-ttyS2.device                                          loaded    active   plugged   /dev/ttyS2
  dev-ttyS3.device                                          loaded    active   plugged   /dev/ttyS3
  sys-devices-pci0000:00-0000:00:03.0-net-ens3.device       loaded    active   plugged   82540EM Gigabit Ethernet Controller (QEMU Virtual Mach
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:0-1:0:0:0-block-sda-sda1.device loaded    active   plugged   QEMU_HARDDISK 1
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:0-1:0:0:0-block-sda-sda2.device loaded    active   plugged   LVM PV kIogiH-f548-A
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:0-1:0:0:0-block-sda.device loaded    active   plugged   QEMU_HARDDISK
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:1-1:0:1:0-block-sdb-sdb1.device loaded    active   plugged   QEMU_HARDDISK 1
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:1-1:0:1:0-block-sdb.device loaded    active   plugged   QEMU_HARDDISK
  sys-devices-pci0000:00-0000:00:04.0-virtio0-host1-target1:0:2-1:0:2:0-block-sr0.device loaded    active   plugged   QEMU_CD-ROM
  sys-devices-platform-serial8250-tty-ttyS1.device          loaded    active   plugged   /sys/devices/platform/serial8250/tty/ttyS1
  sys-devices-platform-serial8250-tty-ttyS2.device          loaded    active   plugged   /sys/devices/platform/serial8250/tty/ttyS2
  sys-devices-platform-serial8250-tty-ttyS3.device          loaded    active   plugged   /sys/devices/platform/serial8250/tty/ttyS3
  sys-devices-pnp0-00:05-tty-ttyS0.device                   loaded    active   plugged   /sys/devices/pnp0/00:05/tty/ttyS0
  sys-devices-virtual-block-dm\x2d0.device                  loaded    active   plugged   /sys/devices/virtual/block/dm-0
  sys-devices-virtual-net-virbr0.device                     loaded    active   plugged   /sys/devices/virtual/net/virbr0
  sys-devices-virtual-net-virbr0\x2dnic.device              loaded    active   plugged   /sys/devices/virtual/net/virbr0-nic
  sys-module-configfs.device                                loaded    active   plugged   /sys/module/configfs
  sys-subsystem-net-devices-ens3.device                     loaded    active   plugged   82540EM Gigabit Ethernet Controller (QEMU Virtual Mach
  sys-subsystem-net-devices-virbr0.device                   loaded    active   plugged   /sys/subsystem/net/devices/virbr0
  sys-subsystem-net-devices-virbr0\x2dnic.device            loaded    active   plugged   /sys/subsystem/net/devices/virbr0-nic
  -.mount                                                   loaded    active   mounted   /
  boot.mount                                                loaded    active   mounted   /boot
  dev-hugepages.mount                                       loaded    active   mounted   Huge Pages File System
  dev-mqueue.mount                                          loaded    active   mounted   POSIX Message Queue File System
  proc-fs-nfsd.mount                                        loaded    active   mounted   NFSD configuration filesystem
  proc-sys-fs-binfmt_misc.mount                             loaded    inactive dead      Arbitrary Executable File Formats File System
  run-user-0.mount                                          loaded    active   mounted   /run/user/0
  run-user-42.mount                                         loaded    active   mounted   /run/user/42
  sys-fs-fuse-connections.mount                             loaded    inactive dead      FUSE Control File System
  sys-kernel-config.mount                                   loaded    active   mounted   Configuration File System
  sys-kernel-debug.mount                                    loaded    active   mounted   Debug File System
  tmp.mount                                                 loaded    inactive dead      Temporary Directory
  var-lib-nfs-rpc_pipefs.mount                              loaded    active   mounted   RPC Pipe File System
  brandbot.path                                             loaded    active   waiting   Flexible branding
  cups.path                                                 loaded    active   waiting   CUPS Printer Service Spool
  systemd-ask-password-console.path                         loaded    inactive dead      Dispatch Password Requests to Console Directory Watch
  systemd-ask-password-plymouth.path                        loaded    active   waiting   Forward Password Requests to Plymouth Directory Watch
  systemd-ask-password-wall.path                            loaded    active   waiting   Forward Password Requests to Wall Directory Watch
  session-1.scope                                           loaded    active   running   Session 1 of user root
  session-c1.scope                                          loaded    active   running   Session c1 of user gdm
  abrt-ccpp.service                                         loaded    active   exited    Install ABRT coredump hook
  abrt-oops.service                                         loaded    active   running   ABRT kernel log watcher
  abrt-vmcore.service                                       loaded    inactive dead      Harvest vmcores for ABRT
  abrt-xorg.service                                         loaded    active   running   ABRT Xorg log watcher
  abrtd.service                                             loaded    active   running   ABRT Automated Bug Reporting Tool
  accounts-daemon.service                                   loaded    active   running   Accounts Service
  acpid.service                                             loaded    active   running   ACPI Event Daemon
  alsa-restore.service                                      loaded    inactive dead      Save/Restore Sound Card State
  alsa-state.service                                        loaded    active   running   Manage Sound Card State (restore and store)
● apparmor.service                                          not-found inactive dead      apparmor.service
  atd.service                                               loaded    active   running   Job spooling tools
  auditd.service                                            loaded    active   running   Security Auditing Service
  auth-rpcgss-module.service                                loaded    inactive dead      Kernel Module supporting RPCSEC_GSS
  avahi-daemon.service                                      loaded    active   running   Avahi mDNS/DNS-SD Stack
  blk-availability.service                                  loaded    active   exited    Availability of block devices
  brandbot.service                                          loaded    inactive dead      Flexible Branding Service
  chronyd.service                                           loaded    active   running   NTP client/server
  colord.service                                            loaded    active   running   Manage, Install and Generate Color Profiles
  cpupower.service                                          loaded    inactive dead      Configure CPU power related settings
  cups.service                                              loaded    inactive dead      CUPS Printing Service
  dbus.service                                              loaded    active   running   D-Bus System Message Bus
  dm-event.service                                          loaded    inactive dead      Device-mapper event daemon
  dmraid-activation.service                                 loaded    inactive dead      Activation of DM RAID sets
  dracut-shutdown.service                                   loaded    inactive dead      Restore /run/initramfs
  emergency.service                                         loaded    inactive dead      Emergency Shell
● exim.service                                              not-found inactive dead      exim.service
  fcoe.service                                              loaded    inactive dead      Open-FCoE Inititator.
● firewalld.service                                         masked    inactive dead      firewalld.service
  firstboot-graphical.service                               loaded    inactive dead      firstboot configuration program (graphical mode)
  gdm.service                                               loaded    active   running   GNOME Display Manager
  getty@tty1.service                                        loaded    inactive dead      Getty on tty1
  gssproxy.service                                          loaded    active   running   GSSAPI Proxy Daemon
● initial-setup-graphical.service                           not-found inactive dead      initial-setup-graphical.service
  ip6tables.service                                         loaded    active   exited    IPv6 firewall with ip6tables
  iptables.service                                          loaded    active   exited    IPv4 firewall with iptables
  irqbalance.service                                        loaded    inactive dead      irqbalance daemon
  iscsi-shutdown.service                                    loaded    active   exited    Logout off all iSCSI sessions on shutdown
  iscsi.service                                             loaded    inactive dead      Login and scanning of iSCSI devices
  iscsid.service                                            loaded    inactive dead      Open-iSCSI
  iscsiuio.service                                          loaded    inactive dead      iSCSI UserSpace I/O driver
  kdump.service                                             loaded    inactive dead      Crash recovery kernel arming
  kmod-static-nodes.service                                 loaded    active   exited    Create list of required static device nodes for the cu
  ksm.service                                               loaded    active   exited    Kernel Samepage Merging
  ksmtuned.service                                          loaded    active   running   Kernel Samepage Merging (KSM) Tuning Daemon
  libstoragemgmt.service                                    loaded    active   running   libstoragemgmt plug-in server daemon
  libvirt-guests.service                                    loaded    inactive dead      Suspend Active Libvirt Guests
  libvirtd.service                                          loaded    active   running   Virtualization daemon
● livesys.service                                           not-found inactive dead      livesys.service
  lldpad.service                                            loaded    inactive dead      Link Layer Discovery Protocol Agent Daemon.
● lvm2-activation-early.service                             not-found inactive dead      lvm2-activation-early.service
● lvm2-activation.service                                   not-found inactive dead      lvm2-activation.service
  lvm2-lvmetad.service                                      loaded    active   running   LVM2 metadata daemon
  lvm2-lvmpolld.service                                     loaded    inactive dead      LVM2 poll daemon
  lvm2-monitor.service                                      loaded    active   exited    Monitoring of LVM2 mirrors, snapshots etc. using dmeve
  lvm2-pvscan@8:2.service                                   loaded    active   exited    LVM2 PV scan on device 8:2
  mdmonitor.service                                         loaded    inactive dead      Software RAID monitoring and management
  microcode.service                                         loaded    inactive dead      Load CPU microcode update
  ModemManager.service                                      loaded    active   running   Modem Manager
  multipathd.service                                        loaded    inactive dead      Device-Mapper Multipath Device Controller
  netcf-transaction.service                                 loaded    active   exited    Rollback uncommitted netcf network config change trans
● network.service                                           loaded    failed   failed    LSB: Bring up/down networking
  NetworkManager-wait-online.service                        loaded    active   exited    Network Manager Wait Online
  plymouth-quit-wait.service                                loaded    inactive dead      Wait for Plymouth Boot Screen to Quit
  plymouth-quit.service                                     loaded    inactive dead      Terminate Plymouth Boot Screen
  rhel-autorelabel-mark.service                             loaded    inactive dead      Mark the need to relabel after reboot
  rhel-autorelabel.service                                  loaded    inactive dead      Relabel all filesystems, if necessary
  rhel-configure.service                                    loaded    inactive dead      Reconfigure the system on administrator request
  rhel-dmesg.service                                        loaded    active   exited    Dump dmesg to /var/log/dmesg
  user.slice                                                loaded    active   active    User and Session Slice
  avahi-daemon.socket                                       loaded    active   running   Avahi mDNS/DNS-SD Stack Activation Socket
  cups.socket                                               loaded    active   listening CUPS Printing Service Sockets
  dbus.socket                                               loaded    active   running   D-Bus System Message Bus Socket
  dm-event.socket                                           loaded    active   listening Device-mapper event daemon FIFOs
  iscsid.socket                                             loaded    active   listening Open-iSCSI iscsid Socket
  iscsiuio.socket                                           loaded    active   listening Open-iSCSI iscsiuio Socket
  lvm2-lvmetad.socket                                       loaded    active   running   LVM2 metadata daemon socket
  lvm2-lvmpolld.socket                                      loaded    active   listening LVM2 poll daemon socket
  rpcbind.socket                                            loaded    active   running   RPCbind Server Activation Socket
  sshd.socket                                               loaded    inactive dead      OpenSSH Server Socket
  syslog.socket                                             loaded    inactive dead      Syslog Socket
  systemd-initctl.socket                                    loaded    active   listening /dev/initctl Compatibility Named Pipe
  systemd-journald.socket                                   loaded    active   running   Journal Socket
  systemd-shutdownd.socket                                  loaded    active   listening Delayed Shutdown Socket
LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

281 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

 

4. Now suppose we want to see all the service unit files on the system.
Then we can use below command.

[root@host-1-89 ~]# systemctl --type service --all
  UNIT                                                       LOAD      ACTIVE   SUB     DESCRIPTION
  abrt-ccpp.service                                          loaded    active   exited  Install ABRT coredump hook
  abrt-oops.service                                          loaded    active   running ABRT kernel log watcher
  abrt-vmcore.service                                        loaded    inactive dead    Harvest vmcores for ABRT
  abrt-xorg.service                                          loaded    active   running ABRT Xorg log watcher
  abrtd.service                                              loaded    active   running ABRT Automated Bug Reporting Tool
  accounts-daemon.service                                    loaded    active   running Accounts Service
  acpid.service                                              loaded    active   running ACPI Event Daemon
  alsa-restore.service                                       loaded    inactive dead    Save/Restore Sound Card State
  alsa-state.service                                         loaded    active   running Manage Sound Card State (restore and store)
● apparmor.service                                           not-found inactive dead    apparmor.service
  atd.service                                                loaded    active   running Job spooling tools
  auditd.service                                             loaded    active   running Security Auditing Service
  auth-rpcgss-module.service                                 loaded    inactive dead    Kernel Module supporting RPCSEC_GSS
  avahi-daemon.service                                       loaded    active   running Avahi mDNS/DNS-SD Stack
  blk-availability.service                                   loaded    active   exited  Availability of block devices
  brandbot.service                                           loaded    inactive dead    Flexible Branding Service
  chronyd.service                                            loaded    active   running NTP client/server
  colord.service                                             loaded    active   running Manage, Install and Generate Color Profiles
  cpupower.service                                           loaded    inactive dead    Configure CPU power related settings
  cups.service                                               loaded    inactive dead    CUPS Printing Service
  dbus.service                                               loaded    active   running D-Bus System Message Bus
  dm-event.service                                           loaded    inactive dead    Device-mapper event daemon
  dmraid-activation.service                                  loaded    inactive dead    Activation of DM RAID sets
  dracut-shutdown.service                                    loaded    inactive dead    Restore /run/initramfs
  emergency.service                                          loaded    inactive dead    Emergency Shell
● exim.service                                               not-found inactive dead    exim.service
  fcoe.service                                               loaded    inactive dead    Open-FCoE Inititator.
● firewalld.service                                          masked    inactive dead    firewalld.service
  firstboot-graphical.service                                loaded    inactive dead    firstboot configuration program (graphical mode)
  gdm.service                                                loaded    active   running GNOME Display Manager
  getty@tty1.service                                         loaded    inactive dead    Getty on tty1
  gssproxy.service                                           loaded    active   running GSSAPI Proxy Daemon
● initial-setup-graphical.service                            not-found inactive dead    initial-setup-graphical.service
  ip6tables.service                                          loaded    active   exited  IPv6 firewall with ip6tables
  iptables.service                                           loaded    active   exited  IPv4 firewall with iptables
  irqbalance.service                                         loaded    inactive dead    irqbalance daemon
  iscsi-shutdown.service                                     loaded    active   exited  Logout off all iSCSI sessions on shutdown
  iscsi.service                                              loaded    inactive dead    Login and scanning of iSCSI devices
  iscsid.service                                             loaded    inactive dead    Open-iSCSI
  iscsiuio.service                                           loaded    inactive dead    iSCSI UserSpace I/O driver
  kdump.service                                              loaded    inactive dead    Crash recovery kernel arming
  kmod-static-nodes.service                                  loaded    active   exited  Create list of required static device nodes for the cur
  ksm.service                                                loaded    active   exited  Kernel Samepage Merging
  ksmtuned.service                                           loaded    active   running Kernel Samepage Merging (KSM) Tuning Daemon
  libstoragemgmt.service                                     loaded    active   running libstoragemgmt plug-in server daemon
  libvirt-guests.service                                     loaded    inactive dead    Suspend Active Libvirt Guests
  libvirtd.service                                           loaded    active   running Virtualization daemon
● livesys.service                                            not-found inactive dead    livesys.service
  lldpad.service                                             loaded    inactive dead    Link Layer Discovery Protocol Agent Daemon.
● lvm2-activation-early.service                              not-found inactive dead    lvm2-activation-early.service
● lvm2-activation.service                                    not-found inactive dead    lvm2-activation.service
  lvm2-lvmetad.service                                       loaded    active   running LVM2 metadata daemon
  lvm2-lvmpolld.service                                      loaded    inactive dead    LVM2 poll daemon
  lvm2-monitor.service                                       loaded    active   exited  Monitoring of LVM2 mirrors, snapshots etc. using dmeven
  lvm2-pvscan@8:2.service                                    loaded    active   exited  LVM2 PV scan on device 8:2
  mdmonitor.service                                          loaded    inactive dead    Software RAID monitoring and management
  microcode.service                                          loaded    inactive dead    Load CPU microcode update
  ModemManager.service                                       loaded    active   running Modem Manager
  multipathd.service                                         loaded    inactive dead    Device-Mapper Multipath Device Controller
  netcf-transaction.service                                  loaded    active   exited  Rollback uncommitted netcf network config change transa
● network.service                                            loaded    failed   failed  LSB: Bring up/down networking
  NetworkManager-wait-online.service                         loaded    active   exited  Network Manager Wait Online
  NetworkManager.service                                     loaded    active   running Network Manager
  nfs-config.service                                         loaded    inactive dead    Preprocess NFS configuration
  nfs-idmapd.service                                         loaded    active   running NFSv4 ID-name mapping service
  nfs-mountd.service                                         loaded    active   running NFS Mount Daemon
  nfs-server.service                                         loaded    active   exited  NFS server and services

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

146 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

 

5. Start/Stop a Unit.

[root@host-1-129 ~]# systemctl  | grep -i cups
  cups.path                                                                                   loaded active waiting   CUPS Printer Service Spool
  cups.socket                                                                                 loaded active listening CUPS Printing Service Sockets
[root@host-1-129 ~]# systemctl stop cups.path
[root@host-1-129 ~]# systemctl  | grep -i cups
  cups.socket                                                                                 loaded active listening CUPS Printing Service Sockets
[root@host-1-129 ~]# systemctl start cups.path
[root@host-1-129 ~]# systemctl  | grep -i cups
  cups.path                                                                                   loaded active waiting   CUPS Printer Service Spool
  cups.socket                                                                                 loaded active listening CUPS Printing Service Sockets
[root@host-1-129 ~]# systemctl --all | grep -i cups
  cups.path                                                                                                      loaded    active   waiting   CUPS Printer Service Spool
  cups.service                                                                                                   loaded    inactive dead      CUPS Printing Service
  cups.socket                                                                                                    loaded    active   listening CUPS Printing Service Sockets
[root@host-1-129 ~]# systemctl start cups.service
[root@host-1-129 ~]# systemctl --all | grep -i cups
  cups.path                                                                                                      loaded    active   waiting   CUPS Printer Service Spool
  cups.service                                                                                                   loaded    active   running   CUPS Printing Service
  cups.socket                                                                                                    loaded    active   running   CUPS Printing Service Sockets
[root@host-1-129 ~]#

 

6. Check status of a unit.

[root@host-1-129 ~]# systemctl status cups.service
● cups.service - CUPS Printing Service
   Loaded: loaded (/usr/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-06-10 09:37:40 BST; 3min 40s ago
 Main PID: 7459 (cupsd)
   CGroup: /system.slice/cups.service
           └─7459 /usr/sbin/cupsd -f

Jun 10 09:37:40 host-1-129.linuxngel.net systemd[1]: Started CUPS Printing Service.
Jun 10 09:37:40 host-1-129.linuxngel.net systemd[1]: Starting CUPS Printing Service...
[root@host-1-129 ~]#

 

7. Check if a unit is enabled or not.

[root@host-1-129 ~]# systemctl is-enabled cups.service
enabled

### To enable the service to start on system boot
# systemctl enable cups.service

### To disable a service
# systemctl disable cups.service

8. To reload systemd daemon to recognize any new/remvoved unit.

[root@host-1-129 ~]# systemctl daemon-reload
[root@host-1-129 ~]#

Leave a Reply

Your email address will not be published.