Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Use Systemctl Command to Manage Systemd Services

    How to Use Systemctl Command to Manage Systemd Services

    By RahulDecember 30, 20172 Mins Read

    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.

    Advertisement

    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

    services systemd systmectl
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Understanding 2>&1 in Bash: A Beginner’s Guide

    How to Choose the Best Shebang (#!) for Your Shell Scripts

    Modulus Operator (%) in Bash

    Using Modulus Operator (%) in Bash

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.