Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Chkservice – An Easy Way to Manage Systemd Units in Terminal
Systemd is the default init system for many modern Linux distributions, including Debian, Ubuntu, and Fedora. Systemd is responsible for starting and stopping services, managing system resources, and providing a variety of other system-related functions. Systemd units are the basic building blocks of systemd and define the services, targets, and other system objects that are managed by the system.
While systemd provides a powerful and flexible way to manage system resources, it can be somewhat complex and intimidating to use. Fortunately, there are several tools available that can help you manage systemd units more easily, and one of the most popular of these tools is chkservice.
Chkservice is a command-line tool that provides an easy way to manage systemd units in Terminal. With chkservice, you can start, stop, enable, disable, and manage systemd units in a simple and intuitive way. In this article, we will take a closer look at chkservice and show you how to use it to manage systemd units in your Linux system.
Installing Chkservice
Chkservice is available in the official repositories of many Linux distributions, including Debian, Ubuntu, and Fedora. To install chkservice on your system, open a terminal window and type the following command
sudo apt-get install chkservice
For other distributions, you can use the appropriate package manager
# For Fedora/RHEL/CentOS sudo dnf install chkservice # For Arch Linux sudo pacman -S chkservice
If chkservice is not available in your distribution's repository, you can download it from the project's GitHub page and compile it manually.
Using Chkservice
Once you have installed chkservice, you can start using it to manage systemd units in your system. Chkservice provides a simple and intuitive interface that makes it easy to manage systemd units without needing to remember complex systemctl commands.
Listing Systemd Units
To list all the systemd units installed on your system, type the following command
chkservice
This will launch an interactive interface showing all systemd units with their current status. You can also list units in a simple format
chkservice --list
Interactive Mode
The main feature of chkservice is its interactive terminal interface. When you run chkservice without arguments, it opens a menu-driven interface where you can
Navigate through services using arrow keys
Press
sto start/stop a servicePress
eto enable/disable a servicePress
rto restart a servicePress
Rto reload a servicePress
qto quit
Command Line Operations
Starting and Stopping Services
To start a systemd unit, type the following command
sudo chkservice start <unit-name>
For example, to start the Apache web server
sudo chkservice start apache2
To stop a systemd unit
sudo chkservice stop apache2
Enabling and Disabling Services
To enable a systemd unit to start automatically at boot time
sudo chkservice enable apache2
To disable a systemd unit from starting automatically at boot time
sudo chkservice disable apache2
Restarting and Reloading Services
To restart a systemd unit
sudo chkservice restart apache2
To reload a systemd unit (reload configuration without stopping)
sudo chkservice reload apache2
Key Features
| Feature | Description |
|---|---|
| Interactive Interface | Menu-driven terminal interface with keyboard shortcuts |
| Tab Completion | Auto-complete service names when typing commands |
| Systemd Integration | Full integration with systemd units and services |
| SysV Support | Can also manage legacy SysVinit scripts |
| Status Display | Shows real-time status of services (enabled/disabled, running/stopped) |
Managing Legacy SysVinit Scripts
In addition to managing systemd units, chkservice can also handle SysVinit scripts for backward compatibility. You can use the same commands for legacy scripts
sudo chkservice start script-name sudo chkservice stop script-name sudo chkservice enable script-name sudo chkservice disable script-name
Advantages Over systemctl
User-friendly interface Interactive menu eliminates need to remember complex systemctl syntax
Visual feedback Clear display of service status and state changes
Tab completion Makes command-line usage faster and error-free
Unified management Handles both systemd units and legacy SysV scripts
Conclusion
Chkservice provides a simplified, user-friendly interface for managing systemd units and legacy SysVinit scripts in Linux. Its interactive terminal interface and intuitive commands make system service management more accessible, especially for users who prefer a menu-driven approach over complex systemctl syntax. Whether you're a system administrator or a Linux enthusiast, chkservice can significantly streamline your service management workflow.
