Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I understand from runlevels is that in each level some programs have permission to be executed and some don't. runlevel 3 boots system into CLI and runlevel 5 starts the default GUI.

But I don't understand what do 0(shutdown) and 6(reboot) mean?(Start in shutdown/reboot mode?!). What happens If set initdefault to these values?

share|improve this question
up vote 12 down vote accepted

If you start in these, the system will shut down/reboot as soon as it enters the runlevel. A runlevel is essentially just a way of specifying actions you want to take when you enter/leave a certain state, in that respect, once those runlevels are entered they execute programs that prepare the computer to shut down or reboot, respectively.

share|improve this answer
But why is this possible? And if set initdefault to 6, then how to solve it? – Alex Jun 1 '15 at 16:30
@Alex Unix doesn't stop you from doing stupid things, because that would also stop you from doing potentially useful things. If you get into this state, you can just modify your files from another environment that's not using that init configuration (or boot into single user mode). – Chris Down Jun 1 '15 at 21:23
Thank you, but which of another environments do you mean, for example? – Alex Jun 1 '15 at 21:35
@Alex For example, booting into a live CD. If you have a separate question, you should ask it as such, though -- doing so helps keep the site relevant for other readers :-) – Chris Down Jun 1 '15 at 21:53

You can check this out first hand in


If a script name starts with an "S", it runs at startup; if it starts with a "K", it runs at shutdown (or, when moving down a level). Check out this answer and especially the comments (corrections) made by James O'Gorman.

Edit - be sure to check out Dave Sherohman's comment below.

share|improve this answer
I think it would be clearer to say that "S" scripts run when the system enters that runlevel and "K" scripts run when it leaves that runlevel (by entering a different one). "Startup" and "shutdown" sound like you're talking about system startup/shutdown, which is not the case here. – Dave Sherohman Nov 15 '12 at 11:01
Hej! Yes, I agree. Made an edit. – Emanuel Berg Nov 15 '12 at 16:42
I still think it is unclear. Moving from runlevel 1 to 2 (in Debian, that's traditionally the transition from single-user to multi-user-without-X) runs the runlevel 1 K scripts (followed by the runlevel 2 S scripts), but certainly doesn't move "down a level". Same for runlevel 3 or 5 to 6, or 3 to 0, or any of a myriad other combinations. It is much better to simply reason about what scripts are run when entering (S, if any exist) or exiting (K, again if any exist) a specific runlevel. – Michael Kjörling Nov 15 '12 at 19:37
@MichaelKjörling: Yes: "S" for enter (you could think of "start" although it could originally be something else - well, doesn't matter as long as you remember it), and "K" for exit ("kill"). This seems to be straightforward enough, so I'll make an effort to be less "relaxed" when I describe things in the future. – Emanuel Berg Nov 15 '12 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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