"systemctl status/start/stop/enable/disable" Commands

This section provides a quick introduction of the 'systemctl' command, which allows you to start or stop a system service, check the status of a service, and enable or disable a service at the boot time.

What Is "systemctl" Command? "systemctl" is a command to interact with "systemd", the system and service manager.

The most common tasks you can perform with the "systemctl" command are:

1. "systemctl status service_name" - To check the status of a given service. By the way, the ".service" postfix of a service name can be omitted when specifying the service name.

herong$ systemctl status gpu-manager

● gpu-manager.service - Detect the available GPUs and deal with any system changes
   Loaded: loaded (/lib/systemd/system/gpu-manager.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sun 2025-12-14 13:59:58 EST; 1 weeks 6 days ago
 Main PID: 1109 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Detect the available GPUs and deal with any system change
systemd[1]: Started Detect the available GPUs and deal with any system changes

2. "systemctl start service_name" - To start a given service.

3. "systemctl stop service_name" - To stop a given service.

4. "systemctl enable service_name" - To enable a given service at system boot time.

herong$ sudo systemctl enable cockpit.socket
Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket ->
  /usr/lib/systemd/system/cockpit.socket.

5. "systemctl disable service_name" - To disable a given service at system boot time. The "disabled" status of the service file will be displayed in the "systemctl status" command output.

herong$ sudo systemctl disable cockpit.socket
Removed /etc/systemd/system/sockets.target.wants/cockpit.socket.

herong$ systemctl status cockpit.socket
* cockpit.socket - Cockpit Web Service Socket
   Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; disabled; ...
   Active: inactive (dead)
     Docs: man:cockpit-ws(8)
   Listen: [::]:9090 (Stream)

5. "systemctl --all list-units" - To list all services, including inactive ones. The output bellow shows 457 services with different statuses on my Ubuntu computer.

herong$ systemctl --all list-units | wc
    457    3173  106109

herong$ systemctl --all list-units
  UNIT                  LOAD   ACTIVE   SUB     DESCRIPTION
  dev-block-8:19.device loaded active   plugged TOSHIBA_DT01ACA2 primary
  dev-cl-home.device    loaded active   plugged /dev/cl/home
  -.mount               loaded active   mounted Root Mount
  boot.mount            loaded active   mounted /boot
  firewalld.service     loaded active   running firewalld - dynamic ...
  nfs-mountd.service    loaded active   running NFS Mount Daemon
  nfs-server.service    loaded active   exited  NFS server and services
  nfs-utils.service     loaded inactive dead    NFS server and client ...
* ypserv.service     not-found inactive dead    ypserv.service
  ...

6. "systemctl --all list-unit-files" - To list all service definition file.

herong$ systemctl list-unit-files | wc
    496     993   26206

herong$ systemctl list-unit-files *httpd*
NIT FILE                                   STATE
boot.mount                                 generated
dev-mqueue.mount                           static
home.mount                                 generated
cockpit.service                            static
console-getty.service                      disabled
crond.service                              enabled
sssd-sudo.service                          indirect
...

Table of Contents

 About This Book

 Introduction to Ubuntu Systems

 GNOME - Desktop Interface and Environment

 Shell - The Command-Line Interpreter

 Process Management

 Memory Management

 Files and Directories

 APT (Advanced Package Tool)

 Network Connection on Ubuntu

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

Administrative Tasks

"systemctl status/start/stop/enable/disable" Commands

 "shutdown" and "halt/poweroff/reboot" Commands

 Move /home Directory to New Partition

 Move All Users to a New System

 "last/lastb" - Review Login History

 References

 Full Version in PDF/EPUB