Run Level is preset operating state in Linux systems. Different run levels have different behaivour. How can we change these run levels easily? What are these run levels?
We will explain the run levels and their meanings in this section
- Run Level 0 is shutdown position. Linux system is powered off. Linun systems run levels transitioned to 0 to shut down.
- Run Level 1 is single user mode there is no network and used rarely
- Run Level 2 is multi user mode but there is no network file system. This level is used rarely too
- Run Level 3 is default mode for the most of the Linux servers. There is no gui but all other services and features are functional
- Run Level 4 is user defined
- Run Level 5 is multi user GUI mode default for most of the user systems.
- Run Level 6 is used to reboot system
How To Change Run Level
Run levels can be changed easily. To change run level root privilege is required.
$ init 3
This will change current run level to run level 3
Boot With Run Level 6
We can reboot Linux system by changing to run level 6 like below
$ init 6
This is the same as reboot command
Run Level With Systemctl
In the old days init was the ruler of the run levels. But times have changed. Now systemctl is the emperor. All most all run level related operations are done with systemctl.
Get Current Run Level With Systemctl
We can get current run level with systemctl like below
$ systemctl get-default
- As you guess multi.user is equal to run level 3
Change Run Level With Systemctl
We can change run leve with systemctl by providing systemctl targets like below
$ systemctl isolate graphical.target
- isolate parameters changes the run level to graphical.target
Set Default Run Level With Systemctl
We can set default run level with systemctl. Default runlevel is start when computer boot. I we want to not start GUI we can change the default run leve to multi-user.target like below
$ systemctl set-default multi-user.target