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

command init seems to be the first process running after each booting.

If I init in my Ubuntu Gnome terminal, will that restart my OS?

share|improve this question
up vote 14 down vote accepted

If you're not root (and you shouldn't normally be logging in as root), you'll just get a message:

bash$ init
init: Need to be root

if you are root, you can change the current run level of the system using init (it actually runs "telinit" to make the change).

bash$ sudo init
init: missing runlevel
Try `init --help' for more information.

if you really want to reboot your system, you can do it by telling init to switch to run level six:

bash$ sudo init 6

(I'm not actually going to do this because I don't want to really reboot my machine.)

For future reference, all of this stuff is well described in the man pages. Try running man init for example. Other interesting man pages include runlevel and telinit.

share|improve this answer
2  
Nice answer! Btw, telinit is actually preferred to change run levels. – SkyDan Jul 8 '12 at 22:10
    
telinit IS init, it is the same executable - just that init does some checks to see whether its PID == 1 or checks what it was invoked with to tell the difference between being in charge of all the other processes or just trying to communicate with the instance that does... – SlySven Dec 17 '15 at 4:25

Your Answer

 
discard

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.