InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search
  • Home
  • > Tutorials
  • > Linux

Linux Systemd/Systemctl quick start guide

on Aug 21, 2016

Systemd is an init system used by new Linux distributions like Ubuntu 15 and Centos 7. It intends to replace Sysv init (Ubuntu, Centos, etc) and upstart (Ubuntu).

Here are some handy Systemd/systemctl commands:

  1. List units
    $ sudo systemctl list-units ## all loaded units in active state
    $ sudo systemctl list-units -all ## all loaded units in any state
    $ sudo systemctl list-unit-files ## all installed units
    
  2. Check status of a service
    $ sudo systemctl status httpd
    httpd.service - The Apache HTTP Server
       Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
       Active: active (running) since Sun 2016-08-21 14:39:03 CEST; 9min ago
         Docs: man:httpd(8)
               man:apachectl(8)
     Main PID: 3095 (httpd)
       Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
       CGroup: /system.slice/httpd.service
               ├─3095 /usr/sbin/httpd -DFOREGROUND
               ├─3096 /usr/sbin/httpd -DFOREGROUND
               ├─3097 /usr/sbin/httpd -DFOREGROUND
               ├─3098 /usr/sbin/httpd -DFOREGROUND
               ├─3099 /usr/sbin/httpd -DFOREGROUND
               └─3100 /usr/sbin/httpd -DFOREGROUND
    

    This outcome tells that httpd is currently running and it is active and hence will also start at boot time.

    To just see if service is active

    $ sudo systemctl is-active httpd
    active
    

    To just see if service is enabled (will start at boot time)

    $ sudo systemctl is-enabled httpd
    enabled
    
  3. Start a service
    $ sudo systemctl start httpd
    ## or
    $ sudo systemctl start httpd.service
    
  4. Re-start a service
    $ sudo systemctl restart httpd
    ## or
    $ sudo systemctl restart httpd.service
    
  5. Stop a service
    $ sudo systemctl stop httpd
    ## or
    $ sudo systemctl stop httpd.service
    
  6. Enable a service during boot
    $ sudo systemctl enable httpd
    ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
    
  7. Disable a service during boot
    $ sudo systemctl disable httpd
    rm '/etc/systemd/system/multi-user.target.wants/httpd.service'
    

Suggested posts:

  1. How to use wildcard in robots.txt
  2. document querySelector examples
  3. LXC (Linux Containers) – quick start tutorial on Ubuntu
  4. Linux yum quick tutorial
  5. Ubuntu – how to find boot autostart status of a service
  6. How to find docker host ip on Mac
  7. Ubuntu – how to auto start services on boot using update-rc.d (sysv init)
  8. Ngrep – quick start guide
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Linux, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress