Systemd is a manager that manages starts, stops, restart services in Linux, and handles how service will start when the system power-up.
Init.d is used before systemd is not in the market. But in recent systemd gain huge popularity and love from the Linux community. Today almost all major Linux distributions ship systemd as the default system component for Linux system.
Table of Contents
List of features comes with systemd.
It is very popular, and my personal favorite journaling utility comes with systemd. It helps the system admin to track what went wrong while starting services.
$ journalctl -xe
Logind or Login Daemon is a systemd service that manages user login. It is responsible for tracking the user’s login and sessions if you use systemctl, which is the command utility of logind, which helps to operate logind from the command line.
$ loginctl SESSION UID USER SEAT TTY 2 1000 trendoceans seat0
Systemctl is one of the most important and powerful utilities of systemd. It helps to control and manage your system services and perform tasks such as start, stop, and restart.
List down all services:
$ systemctl list-unit-files
Above command list down status of all service in your system shown like below.
Get an overview of the specific service status in your system with a simple single line of command.
$ systemctl status sshd
sshd: is a daemon used to control and manage ssh service in your Linux system.
In my case, sshd is currently inactive, so I unable to ssh to my system. We have to start first our sshd service to get into our computer over other networks. So let’s start it.
To start any service using systemctl, find that service name. I wish to stop the sshd service, and then I use the below command to stop.
$ systemctl start [servicename]
$ systemctl start sshd
If you wish to stop running sshd service, then use the below command to stop.
$ systemctl stop sshd
It often happens when you wish to start service at system bootup, like if you are operating your system using ssh in a different location and you need to reboot your system.
In such a situation, it can be a serious problem, like you have to guide someone on how to start the ssh service so you can able to connect to your system.
The first check is sshd start at system bootup to know that check the status of sshd service and check the below-highlighted area in a red circle.
As you have seen above, highlight the red circle. It is disabled, so when the system boot, it cannot autostart sshd service. We need to pass the below command.
$ systemctl enable sshd $ systemctl status sshd
As you have seen in a red circle, it is now enabled, which means it will autostart when the system turn on next time.
If it’s already enabled and you need to disable it, then use the below command.
$ sudo systemctl disable sshd
If you have any query then feel to ask in comment section.
Innovative tech mind with 10 years of experience working as a computer programmer, web developer, and security researcher. Capable of working with a variety of technology and software solutions, and managing databases.