SysVinit Vs systemd Cheatsheet

systemd is a new init system and system manager, that was adopted by most of Linux distributions now over the traditional SysVinit manager.

systemd is compatible with SysV and LSB init scripts.

It can work as a drop-in replacement for sysvinit system.

systemd is the first process started by the kernel and holds PID-1.

This is a parent process for everything and Fedora-15 is the first distribution that embraced the systemd init manager instead of Upstart.

systemctl is a command-line application and the primary tool for managing systemd daemons/services, allowing users to start, restart, stop, enable, disable, reload, and verify the service.

systemd uses .service files instead of bash scripts used by SysVinit.

systemd sorts all daemons in their own Linux cgroups and you can view the system hierarchy by examining the /cgroup/systemd file.

The following articles will help you to learn more about SysVinit and systemd.

Many init systems have been released, but the three init systems below are widely used in Linux.

  • System V (Sys V): System V (Sys V) is one of the first and traditional init systems for the UNIX/Linux operating system.
  • Upstart: Upstart is an event-based replacement for the /sbin/init daemon.
  • systemd: systemd is a new init system and service manager for Linux operating systems.

What is System V (Sys V)

System V (Sys V) is one of the first and traditional init systems for the UNIX/Linux operating system. Init is the first process started by the kernel during system boot, and is a parent process for everything.

Most Linux distributions first started using the traditional init system, called System V (Sys V).

Over the years, several alternative init systems have been released to address design limitations in the stable versions such as launchd, Service Management, systemd and Upstart.

But the systemd has been adopted by many large Linux distributions over the traditional SysVinit manager.

What is systemd

systemd is a new init system and system manager that has become so popular that it has been widely transformed into the new standard init system by most Linux distributions.

Systemctl is a systemd application that allows you to manage the systemd system.

systemd Features:

  • systemd provides aggressive parallelization capabilities
  • Uses socket and D-Bus activation for starting services
  • Offers on-demand starting of daemons
  • Keeps track of processes using Linux cgroups
  • Supports snapshotting and restoring of the system state
  • Maintains mount and automount points
  • Implements an elaborate transactional dependency-based service control logic

Service Commands:

These are the most commonly used service commands on a Linux system to manage services.

Short Description SysVinit Command systemd Command
To Start a Service service example start systemctl start example
To Stop a Service service example stop systemctl stop example
Stop and then Start a Service (Restart a Service) service example restart systemctl restart example
Reload a Service (Reload the config file) service example reload systemctl reload example
Restarts if the service is already running service example condrestart systemctl condrestart example
How to check if a service is currently running service example status systemctl status example
How to enable a service on boot/startup chkconfig example on systemctl enable example
How to disable a service on boot/startup chkconfig example off systemctl disable example
How to check if a service is configured to start on boot or not chkconfig example –list systemctl is-enabled example
How to display a list of enabled or disabled services on boot with runlevels information chkconfig systemctl list-unit-files –type=service
Create a new service file or modify any configuration chkconfig example –add systemctl daemon-reload

Runlevels/Targets:

The systemd has a concept of targets, which serves a similar purpose as runlevels, but operates slightly differently. Each target is named instead of numbers and is intended to serve a specific purpose.

Short Description SysVinit Command systemd Command
To halt the system 0, halt runlevel0.target, poweroff.target, systemctl halt
Single user mode 1, S, single runlevel1.target, rescue.target
Multi User 2 runlevel2.target, multi-user.target
Multi User with Network 3 runlevel3.target, multi-user.target
Experimental (No User) 4 runlevel4.target, multi-user.target
Multi-user with Graphical & Network 5 runlevel5.target, graphical.target
To reboot a system 6, reboot runlevel6.target, reboot.target, systemctl reboot
Emergency shell emergency emergency.target

Other systemd Commands:

There are other commands in systemd that are very useful.

Short Description systemd Command
Control the system hostname hostnamectl
Team daemon control tool teamdctl
Control the system time and date timedatectl
Query the systemd journal journalctl
How to check system boot time systemd-analyze or systemd-analyze time
How to check each service time consumption at startup systemd-analyze blame
Kill all processes associated with a service systemctl kill example
List all running services systemctl
Show system status systemctl status
How to run the systemd command on a remote machine systemctl status example -H user@remotehost

About Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

View all posts by Prakash Subramanian

2 Comments on “SysVinit Vs systemd Cheatsheet”

Leave a Reply

Your email address will not be published. Required fields are marked *