How to Manage Systemd Services and Units Using Systemctl in Linux.
Starting with Systemtd and Systemctl Basics
First, check if systemd is installed on your system or not, and what is the version of currently installed Systemd?
systemctl --version
Check where the binaries and libraries of systemd and systemctl are installed.
whereis systemd
whereis systemctl
Check whether systemd is running or not.
ps -eaf | grep [s]ystemd
Analyze systemd boot process.
systemd-analyze
Analyze time taken by each process at boot.
systemd-analyze blame
List all the available units.
systemctl list-unit-files
List all running units.
systemctl list-units
List all failed units.
systemctl --failed
Check if a Unit (cron.service) is enabled or not?.
systemctl is-enabled crond.service
Check whether a Unit or Service is running or not?.
systemctl status httpd
Control and Manage Services Using Systemctl
List all services (including enabled and disabled).
systemctl list-unit-files --type=service
How do I start, restart, stop, reload and check the status of a service (httpd.service) in Linux.
systemctl start httpd
systemctl enable httpd
systemctl stop httpd
systemctl reload httpd
systemctl status httpd
How to active a service and enable or disable a service at boot time (autostart service at system boot).
systemctl is-active httpd.service
systemctl enable httpd.service
systemctl disable httpd.service
How to mask (making it impossible to start) or unmask a service (httpd.service).
systemctl mask httpd.service
systemctl unmask httpd.service
How to a Kill a service using systemctl command.
systemctl kill httpd
systemctl status httpd
Control and Manage Mount Points using Systemctl
List all system mount points.
systemctl list-unit-files --type=mount
How do I mount, unmount, remount, reload system mount points and also check the status of mount points on the system?
systemctl start tmp.mount
systemctl stop tmp.mount
systemctl restart tmp.mount
systemctl reload tmp.mount
systemctl status tmp.mount
How to active, enable or disable a mount point at boot time (auto mount at system boot).
systemctl is-active tmp.mount
systemctl enable tmp.mount
systemctl disable tmp.mount
How to mask (making it impossible to start) or unmask a mount point in Linux.
systemctl mask tmp.mount
systemctl unmask tmp.mount
Control and Manage Sockets using Systemctl
List all available system sockets.
systemctl list-unit-files --type=socket
How do I start, restart, stop, reload and check the status of a socket (example: cups.socket) in Linux.
systemctl start cups.socket
systemctl restart cups.socket
systemctl stop cups.socket
systemctl reload cups.socket
systemctl status cups.socket
How to active a socket and enable or disable at boot time (autostart socket at system boot).
systemctl is-active cups.socket
systemctl enable cups.socket
systemctl disable cups.socket
How to mask (making it impossible to start) or unmask a socket (cups.socket).
systemctl mask cups.socket
systemctl unmask cups.socket
Conclusion
We hope everyone understands How to Manage Systemd Services and Units Using Systemctl in Linux. Are you looking for cheap web hosting service providers? Then this is your last destination to end your search. We at TheStack provide premium WordPress hosting, hybrid smart server hosting, SEO dedicated server hosting, cheap dedicated server hosting, and managed virtual private servers at the best price. So, what are you waiting for? Give us a quote to work with us.