systemctl command not found - Ubuntu

How to Install systemctl Command on Ubuntu

If you’re encountering the “systemctl command not found” error on your Ubuntu system, it may be because the systemctl command is not included by default in Ubuntu. systemctl is a command-line utility that is used to introspect and control the systemd system and service manager.

To install the systemctl command on Ubuntu, you can follow these steps:

  1. Check systemd Installation: First, ensure that systemd is installed on your Ubuntu system. You can do this by running the following command:

    dpkg -l | grep systemd
    

    If systemd is not installed, you can install it using the following command:

    sudo apt update
    sudo apt install systemd
    
  2. Install systemd-sysv Package: The systemd-sysv package provides the systemctl command on Ubuntu. You can install it by running:

    sudo apt update
    sudo apt install systemd-sysv
    
  3. Verify Installation: After installing the systemd-sysv package, you should be able to use the systemctl command without any issues. You can verify the installation by running:

    systemctl --version
    
  4. Alternative Command: If for some reason the systemd-sysv package does not work or is not available for your Ubuntu version, you can use the alternative command service to manage services. For example, to start a service named nginx, you can use the following command:

    sudo service nginx start
    

By following these steps, you should be able to successfully install and use the systemctl command on your Ubuntu system for managing services and system configuration.