Skip to content

How to Use Systemctl Command to Manage Systemd Services

Systemctl Commands Line Examples to Manage Systemd Services on Linux. How to Stop/Start/Restart service using systemctl. How to enable/disable service using systemctl. Linux systemctl command to manage systemd services and units

Covers
systemd
On this page

This article will help you to how to manage services using the systemctl command for Systemd services. Systemd is a system and service manager for Linux-based operating systems for managing services. Systemd is more powerful and getting more popularity over older SysVinit. Most of newer release of the Linux-based operating system (eg: CentOS/Redhat 7, Fedora 25, Ubuntu 16.04) using Systemd as a default service management tool.

Before using the following example commands change <servicename> with your actual service name like httpd, mysql, apache2 or ssh.

Start or Stop Service:

Syntax:

$ sudo systemctl start <servicename>.service
$ sudo systemctl stop <servicename>.service
  • start: Used to start a stopped service
  • Stop: Used to stop a running service

Example:

$ sudo systemctl start ssh.service
$ sudo systemctl stop ssh.service

Restart or Reload Service:

$ sudo systemctl reload ssh.service
$ sudo systemctl restart ssh.service
$ sudo systemctl reload-or-restart ssh.service
  • Reload: Used to reload configuration of a running service
  • Restart: Used to restart (Stop/Start) a running service
  • reload-or-restart: Used to reload a service default, but if reload is not available for that service. It will restart it

Check Status of Service:

$ sudo systemctl status ssh.service
  • Status: Used to check current status of a service

Enable or Disable Service:

$ sudo systemctl enable ssh.service
$ sudo systemctl disable ssh.service
  • Enable: Used to enable service to start on system boot
  • Disable: Used to disable service to not to start on system boot

Check Enable/Disable Status of Service:

$ sudo systemctl is-active ssh.service
$ sudo systemctl is-enabled ssh.service
  • is-active: Used to check if service current service status
  • is-enabled: Used to check if service is enabled to start on system boot

Reference:
https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top