Linux has several runlevels which are different modes of operations of the Operating System. Each of the runlevel may be selected according to the user’s requirements. For example while installing device drivers it is recommended to be in single user mode. In fact runlevels are required for both shutdown and restart operations. After the installation of Linux Operating System using default settings the system directly starts in GUI mode. But many people prefer starting the command line terminal mode. Even though you can Ctrl+Alt+F1 at the GUI login screen and enter into terminal 1 its cooler and easier to directly startup with your desired runlevel. Change the default runlevel in linux by following the instructions below.
Proceed with caution as you’ll be editing a system file. Don’t skip the backup step. You should have access to the root account or should be on the sudoers list else it is not possible to edit the file. I’ll be outlining the step for command line editing because on most systems you cannot login as a root user in GUI mode.
Step 1: Login as root user from the command line
If you’re on GUI mode press Ctrl+Alt+[F1 to F6] to open a command line terminal enter your credentials. If you login as a normal user make sure you that account is on the sudoers list.
Step 2: Take a backup of the inittab file
It is very important you take a backup of the /etc/inittab file as you can restore it in case you mess up. If your the root user type
cp /etc/inittab /etc/inittab.bak
If your logged in as a user with sudo permission add sudo to the beginning
sudo cp /etc/inittab /etc/inittab.bak
Step 3: Edit the /etc/inittab file in a text editor
Open the /etc/inittab file using a command line text editor like vi, vim or nano whichever is installed. I’ll use vim for this example. Root users use this command
Sudoers use this command
sudo vim /etc/inittab
Press ‘i’ to enter into insert mode, edit the following line
Change the number 5 to your preferred value except 0 (halt) or 6 (restart). Press [Esc], [shift+:] type wq hit enter. The changes to the file are saved. Restart your Linux OS by typing init 6 and you should see the necessary changes.
Note:- The shortcut keys explained in step 3 will only apply to vi and vim editors if you’re using some other editor read its manual for the corresponding shortcut keys.
Leave a Reply