Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use init command in Linux to shut down, restart, switch mode, etc.

Shulou Source: shulou.com Published: 2022-06-01 16:04:36 10月01日 Update

This article introduces the relevant knowledge of "how to use the init command in Linux to shut down, restart, switch mode, etc.". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Linux has a file / etc/inittab

The code is as follows:

#

# inittab This file describes how the INIT process should set up

# the system in a certain run-level.

#

# Author: Miquel van Smoorenburg

# Modified for RHS Linux by Marc Ewing and Donnie Barnes

#

# Default runlevel. The runlevels used by RHS are:

# 0-halt (Do NOT set initdefault to this)

# 1-Single user mode

# 2-Multiuser, without NFS (The same as 3, if you do not have networking)

# 3-Full multiuser mode

# 4-unused

# 5-X11

# 6-reboot (Do NOT set initdefault to this)

#

Id:3:initdefault:

0 is the shutdown

1 is a single user

2 is multi-user and does not connect to the Internet.

3 is multi-user

4 is not used

5 is xwindows, that is, with an interface.

6 is reboot

The init command is simple. Just enter init + the mode you want and enter.

For example, enter "init 0" to shut down the computer.

Init 3 is to switch to multi-user.

Init 5 is to switch to the interface.

Init 6 is a restart.

When I experiment, I do it under root users. I don't know if other users can do it.

This is the end of the content of "how to use init commands in Linux to shut down, restart, switch mode, etc.". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Users switching that is commands modes experiments content more interface knowledge input practical but not successful learning and then that is code dilemma actual situation. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Apple Shulou Information Docker MariaDB