Linux Comm Init
# Linux init Command
[ Linux Command Manual](#)
* * *
## What is the init Command
`init` is one of the most important processes in Linux systems. It is the first user-level process created by the kernel after system boot (PID=1), responsible for starting and managing all other processes in the system.
### Key Features
* **Process Management**: As the parent process of all processes
* **Runlevel Control**: Manages different operating states of the system
* **Service Management**: Starts and stops system services
* **System Initialization**: Executes startup scripts and configurations
* * *
## Basic Syntax of init Command
init
### Runlevel Description
Linux systems define 7 standard runlevels:
| Runlevel | Description | Typical Usage |
| --- | --- | --- |
| 0 | Shutdown | System shutdown state |
| 1 | Single-user mode | System maintenance/root access |
| 2 | Multi-user mode (no NFS) | Basic multi-user mode |
| 3 | Full multi-user mode | Standard command-line interface |
| 4 | Reserved | User-defined |
| 5 | Graphical interface mode | Multi-user mode with GUI |
| 6 | Reboot | System reboot |
* * *
## Practical Applications of init Command
### 1. View Current Runlevel
## Example
who -r
# or
runlevel
### 2. Switch Runlevel
## Example
init 3# Switch to multi-user command-line mode
init 5# Switch to graphical interface mode
init 0# Shutdown
init 6# Reboot system
### 3. Emergency Handling
## Example
init 1# Enter single-user maintenance mode (requires root permissions)
* * *
## Evolution of init in Modern Linux Systems
### 1. System V init
Traditional init system, uses /etc/inittab configuration file
## Example
# Typical inittab entry example
id:3:initdefault: # Default runlevel
si::sysinit:/etc/rc.d/rc.sysinit # System initialization script
### 2. Upstart (used in early Ubuntu versions)
Event-driven init system
### 3. systemd (modern mainstream distributions)
## Example
systemctl isolate multi-user.target # equivalent to init 3
systemctl isolate graphical.target # equivalent to init 5
* * *
## Practical Exercises
### Exercise 1: Runlevel Switching Experiment
Switch from graphical interface to command-line mode
init 3
Observe service changes, then switch back to graphical interface
init 5
### Exercise 2: System Maintenance Mode Experience
Enter single-user mode
init 1
Perform filesystem check
fsck /dev/sda1
* * *
## Notes
1. **Permission Requirements**: The init command typically requires root permissions
2. **Use with Caution**: Directly using init 0 or init 6 may cause data loss of unsaved work
3. **System Differences**: Different distributions may have different init implementations
4. **Service Impact**: Switching runlevels will stop/start related services
* * *
## FAQ
**Q: Why doesn't my system have /etc/inittab file?**
A: Systems using systemd no longer need inittab; the configuration method has changed
**Q: How to set the default runlevel?**
For systemd systems:
systemctl set-default multi-user.target # equivalent to runlevel 3
**Q: What is the difference between init and shutdown commands?**
Both will ultimately shut down the system, but shutdown provides more options (such as delayed shutdown, broadcast notifications, etc.)
[ Linux Command Manual](#)
YouTip