How to change/set the default runlevel – Unix/Linux

The runlevel is specified in the /etc/inittab file. Different runlevels and details are listed below:

0 - halt (Do NOT set initdefault to this)
1 - Single user mode
2 - Multiuser, without NFS (The same as 3, if you do not have networking)
3 - Full multiuser mode
4 - unused
5 - X11
6 - reboot (Do NOT set initdefault to this)

The default runlevel means the runlevel of the Linux system which is appearing by-default after a reboot.
You can findout the current runlevel by executing the following command:

grep id:  /etc/inittab 

Example:

[root@localhost ~]# grep id:  /etc/inittab 
id:5:initdefault:

How to change the default runlevel?
you can change it simply by editing the line which has the runlevel id:

vi /etc/inittab
-----
id:5:initdefault:
-----

Then reboot to get the changes which you have made.

That’s it..!! 🙂

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

Leave a Reply

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