Linux change the runlevel for a server without rebooting

Q. How do I change the runlevel for a Linux server without rebooting my server? I am using Gentoo Linux.

A. Almost all Linux distribution use init program to change runlevel. init is the parent of all processes. Its primary role is to create processes from a script stored in the file
/etc/inittab . This file usually has entries which cause init to spawn gettys on each line that users can log in. It also controls autonomous processes required by any particular system.


To change runlevel from 3 to 1 you need to type command as follows:
# init 1
$ sudo init 1

Where 1 is runlevel number, other possible runlevel values are:
=> 0 – Shutdown server
=> 1 – Take server to single-user mode
=> 2 – Start X Window (used by Debian)
=> 3 – Full multi-user text mode
=> 5 – Start X Window
=> 6 – Reboot server

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

6 comments… add one
  • Peko Apr 6, 2009 @ 18:32

    Hi Vivek,

    Just typos : X is spelled X Window – Capital W, and without an “s”

    so not “Start X windows” … but “Start X Window”

    Thumbs up anyway

    — Peko

    • 🛡️ Vivek Gite (Author and Admin) nixCraft Apr 6, 2009 @ 19:00

      No problem. The FAQ has been updated.

  • Jim H. Aug 13, 2009 @ 22:46

    Another way to do this is by using “telinit”

    Telinit allows you to spawn a session at a different runlevel than your current session – and return to it when you are done.

    I have a Fedora box that I use primarily as a Samba file server on my network – and I have it set to auto-start in runlevel 3 – no graphics – to preserve processor bandwidth for actual file handling. Since I do most of my SMB maintainance through SWAT, the text login is just fine.

    Occasionally though, I want to use a graphical login – so I login to the text login and then sudo telinit 5. That spawns a graphical session I can log into, and then when I exit, I’m right back at the runlevel 3 terminal session.

    It’s handy – especially if you need to pop into a graphical session every now and then – without clobbering your existing user context.

    What say ye?


  • A different Jim H. Jan 4, 2011 @ 17:03

    telinit looks very cool! I was actually looking for the init command, that I hadn’t used in so long I forgot it, but that’s a nice little extra that I sure could have used a couple years ago. I had a manager at one time that wanted a GUI on all of our Linux servers because he wasn’t as comfortable with the command line (being from a Windows background). I would have loved not having to run X full time even though he hardly ever touched those boxes. Thanks for the tip!

    Other Jim

  • Anil Apr 17, 2011 @ 4:38

    How do I change the runlevel for a Linux server without rebooting my server? I am using ubuntu 10.4 version

  • deepak May 17, 2011 @ 18:26

    i am facing a problem that the computer does not prompt for luks passphrase and moves on to the username and password.
    how do i change the runlevel
    where would i get to put the command
    my files are stuck some where and i cannot locate them

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.