init
Start the Linux operating system processes
TLDR
Set the system to run a graphical environment
Set the system to run multiuser terminal
Shut down the system
Reboot the system
Set the system to run on terminal with only root user allowed and no networking
SYNOPSIS
init [0123456Ss]
PARAMETERS
0
Shut down the system.1
Single-user mode.2-5
Multi-user mode. The exact meaning varies between systems.6
Reboot the system.S, s
Single-user mode.
DESCRIPTION
The init
command is the mother of all processes on a Linux system. It's the very first program to be executed by the kernel when the system boots.
init
's primary role is to start all the other processes needed to bring the system to a usable state. It reads its configuration from files like /etc/inittab
(SysVinit) or configuration files located in /etc/systemd/system/
(systemd based systems).
Based on this configuration, it starts processes like daemons, login prompts, and graphical display managers. In essence, init
orchestrates the entire startup sequence, ensuring that essential services are running. It also adopts orphaned processes, preventing them from becoming zombies. While historically using System V init, modern Linux distributions largely rely on systemd, which provides a more sophisticated and parallelized startup mechanism. init
usually resides at PID 1.
CAVEATS
Using init directly to change runlevels is now generally deprecated on systems that use systemd. The systemctl
command is preferred.
RUNLEVELS
Runlevels define the state of the system. Common runlevels include single-user mode (for maintenance), multi-user mode (with networking), and graphical mode. The init
process uses runlevel definitions to start or stop services.
PID 1
init
always has a process ID (PID) of 1. This makes it a special process in the kernel. All other processes are direct or indirect descendants of init
. When a process becomes an orphan (its parent process terminates), init
adopts it, preventing the process from becoming a zombie.
HISTORY
Historically, init
was the primary method for initializing a Unix or Linux system, managed through the /etc/inittab
file. It followed the System V init process, where runlevels defined the active services.
Over time, alternative init systems like Upstart and, most notably, systemd emerged. Systemd offers parallel startup, dependency management, and other advanced features. Most modern Linux distributions have migrated to systemd, but `init` as PID 1 remains, even if it's a symbolic link to systemd's core process.