-1

I was reading about the init command.

I found that init 0 is the same like poweroff and init 6 is the same like reboot.

Why are there more than one command to do the exactly same thing in the same way (as I understood)?

Second, init 1 puts the system in single user mode. Does that mean it has no effect on my machine while I'm the only user? Or that mode has constraints?

edwinksl
  • 23,789

2 Answers2

2

The init command allows you to set what is called the current system runlevel.

All Linux machines have seven runlevels, which are responsible for managing certain system actions and behaviors. On a classical SystemV installation, each runlevel would be part of the boot procedure:

  • Runlevel 0 (Machine off)
  • Runlevel 1 (Singleuser / Diagnostics Mode)
  • Runlevels 2-4 (Bootup and service start)
  • Runlevel 5 (Fully booted system, all services online)
  • Runlevel 6 (Going down for restart)

The init (and telinit) commands allow you to specify what runlevel to move init and the system to.

Note, however, that the entire runlevel concept is now a bit antiquated due to the creation of the service model (through Upstart and systemd (service apache2 start)), and should be considered deprecated in favor of using proper systemd commands.

Using runlevels now runs the risk of terminating essential services, so it is often advised to not use the init or telinit commands.

Kaz Wolfe
  • 34,122
  • 21
  • 114
  • 172
WolfBot
  • 56
0

Always good to have more than only one option to do things.

init 1 means

Single-user mode, all files-systems unmounted but not root, all processes
except console processes killed

This is mostly used for administrative tasks, I guess it is not what you want, no GUI, only console.

mook765
  • 15,925