What Is /etc/init.d
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 11, 2026
Key Facts
- SysVinit system, which /etc/init.d is part of, originated in the 1980s with UNIX System V
- /etc/init.d scripts are executed during runlevels 0-6, with 0 being shutdown and 6 being reboot
- Approximately 95% of major Linux distributions have transitioned to systemd since 2015
- Each /etc/init.d script typically supports at least 8 standard actions: start, stop, restart, reload, status, force-reload, try-restart, and rotate
- The directory structure maintains backward compatibility on most systems, though scripts often redirect to systemd unit files
Overview
/etc/init.d is a system directory found on Unix and Linux operating systems that houses initialization scripts responsible for managing system services and background processes. These scripts are executed at specific points during the system boot sequence and shutdown process to start, stop, configure, or monitor various daemons and services essential to the operating system's functionality.
The directory is a core component of the SysVinit initialization system, which has been the standard for Unix-like systems since the 1980s. While modern Linux distributions increasingly rely on systemd for service management, /etc/init.d remains present on most systems for backward compatibility. System administrators and developers use these scripts to control services like web servers, databases, SSH daemons, and other critical system functions with simple command-line instructions.
How It Works
/etc/init.d scripts operate by executing during specific system runlevels and responding to administrator commands. When a script is called, it interprets the command and performs the corresponding action on the associated service.
- Script Naming Convention: Scripts in /etc/init.d follow a simple naming pattern, with names corresponding to the service they manage (e.g., 'nginx', 'apache2', 'mysql'). These are shell scripts typically written in bash or sh that contain the logic to control services.
- Runlevel Integration: Symbolic links in /etc/rc*.d directories (where * represents runlevels 0-6) reference /etc/init.d scripts. Runlevels determine which services start: level 0 is halt, level 1 is single-user mode, levels 2-5 are multi-user with varying services, and level 6 is reboot.
- Standard Commands: Each script supports standardized actions including 'start' to launch the service, 'stop' to terminate it, 'restart' to stop and start again, 'reload' to reload configuration without stopping, 'status' to check if running, and 'force-reload' to force configuration reloading.
- Execution During Boot: During system startup, the init process reads runlevels and executes appropriate scripts in /etc/rcS.d and /etc/rc*.d directories. Scripts are typically named with S (start) or K (kill) prefixes followed by two digits indicating execution order, allowing administrators to control service startup sequence precisely.
- Manual Service Control: Administrators can manually invoke scripts using the command syntax: sudo /etc/init.d/service-name [command]. This allows dynamic service management without rebooting, enabling quick restarts, configuration reloads, and status checks on-demand.
Key Comparisons
| Feature | /etc/init.d (SysVinit) | systemd |
|---|---|---|
| Introduction | 1980s with UNIX System V | 2010, became standard around 2015 |
| Script Type | Shell scripts in /etc/init.d | Unit files in /etc/systemd/system |
| Dependency Management | Based on runlevels and numeric prefixes | Explicit dependency declarations |
| Parallel Execution | Sequential startup by default | Parallel service startup for faster boot |
| Status Monitoring | Manual checks or basic logging | Journal logging with rich metadata |
| Distribution Support | Legacy support only; ~5% of major distros primary | Default on 95%+ of modern Linux distributions |
Why It Matters
- Historical Significance: /etc/init.d represents a fundamental aspect of Linux system administration that has been in use for decades. Understanding it provides insight into how operating systems manage services and provides knowledge applicable across legacy systems still in production environments.
- Backward Compatibility: Many systems maintain /etc/init.d for backward compatibility, ensuring scripts and tools developed for SysVinit continue functioning. This prevents disruption during gradual migrations to modern service management systems and protects existing automation.
- Learning Foundation: For system administrators and Linux professionals, understanding /etc/init.d provides foundational knowledge of process management, startup sequences, and service lifecycle. This knowledge transfers to modern systemd management and other Unix-like systems.
- Legacy System Support: Organizations running older Linux distributions or embedded systems still rely heavily on /etc/init.d for service management. Knowledge of these scripts remains essential for maintaining and troubleshooting these systems in production environments.
While systemd has become the predominant service management system, /etc/init.d continues as a bridge between legacy systems and modern infrastructure. For anyone working with Linux systems, understanding /etc/init.d scripts provides valuable insight into how Unix-like operating systems manage services, remain compatible across versions, and maintain stability in production environments.
More What Is in Daily Life
Also in Daily Life
More "What Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- Wikipedia - InitCC-BY-SA-4.0
- Wikipedia - SystemdCC-BY-SA-4.0
- Linux Kernel OrganizationGPL-2.0
Missing an answer?
Suggest a question and we'll generate an answer for it.