← 返回命令列表

Linux command

init 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Example

sudo init 5

Example

sudo init 3

Example

sudo init 1

Shut down

init 0

Reboot

init 6

说明

init is the parent of all processes on the system, responsible for starting and stopping services at different runlevels. It is the traditional System V init daemon that manages the system state. Runlevels define different system states, from single-user maintenance mode to full graphical desktop. Changing runlevels causes init to start or stop services as defined in /etc/rc.d or /etc/init.d scripts. On modern systemd-based systems, init may be a compatibility wrapper that translates runlevel commands to systemd targets.

参数

0
Halt the system
1 or S
Single user mode (maintenance)
2
Multi-user mode without NFS (Debian default multi-user with GUI)
3
Multi-user mode with networking, text console only
4
Unused/custom (available for user-defined purposes)
5
Multi-user mode with networking and graphical desktop (Red Hat default GUI)
6
Reboot the system

FAQ

What is the init command used for?

init is the parent of all processes on the system, responsible for starting and stopping services at different runlevels. It is the traditional System V init daemon that manages the system state. Runlevels define different system states, from single-user maintenance mode to full graphical desktop. Changing runlevels causes init to start or stop services as defined in /etc/rc.d or /etc/init.d scripts. On modern systemd-based systems, init may be a compatibility wrapper that translates runlevel commands to systemd targets.

How do I run a basic init example?

Run `sudo init 5` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does 0 do in init?

Halt the system