How Change Run Levels In Linux? – POFTUT

How Change Run Levels In Linux?

Run Level is a preset operating state in Linux systems. Different run levels have different behavior. How can we change these run levels easily? What are these run levels?

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. Linux 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 the default mode for 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 a multi-user GUI mode default for most of the user systems.
  • Run Level 6 is used to reboot the system

List Run Levels

Run levels are stores inside the /etc and named with rc0.d, rc1.d , rc.. to the rc6.d. We can list these run level directories and their content with the ls command like below.

List Run Levels

List Run Levels

We can see that there are scripts which starts with K , S . K means kill and the given script is used to stop or kill related service. S means start` and the given script will start the related service.

How To Change Run Level

Run levels can be changed easily. To change run level root privilege is required.

This will change the current run level to run level 3

LEARN MORE  How To Start, Stop, Restart and Manage Apache Web Server In Linux?

Boot With Run Level 6

We can reboot Linux system by changing to run level 6 like below

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 the current run level with systemctl like below

  • As you guess multi.user is equal to run level 3

Change Run Level With Systemctl

We can change run level with systemctl by providing systemctl targets like below

  • isolate parameters change the run level to graphical.target

Set Default Run Level With Systemctl

We can set default run level with systemctl. Default run level is start when the computer boot. We want to not start GUI we can change the default run level to multi-user.target like below

Leave a Reply

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

Enjoy this blog? Please spread the word :)