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?

  • Why do you think only 1 way to shutdown is better in an Operating System ? – Anwar Sep 18 '16 at 3:47
  • 1
    I don't think I'm just asking – Ammar Hussein Sep 18 '16 at 3:53

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.

| improve this answer | |

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.

| improve this answer | |
  • 1
    Nice answer! A small quibble: didn't recent versions of Ubuntu move away from upstart, to systemd? I thought upstart wasn't used anymore. – Nick Weinberg Sep 18 '16 at 5:27
  • @NickWeinberg Ah, yeah, that's right. I'll edit the post. It's late here and I'm not thinking properly lol – Kaz Wolfe Sep 18 '16 at 5:32
  • Many Linux machines in fact do not have run levels at all, nowadays, systemd having declared them "obsolete". – JdeBP Sep 19 '16 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.