How to check and change runlevels in RHEL

How to check and change runlevels in RHEL

A runlevel is one of the modes that a Unix-based OS will run on. Each runlevel has a certain number of services stopped or started, giving the user control over the behavior of the machine.

The following runlevels are defined by default under Red Hat Enterprise Linux:

Run LevelMode
0Halt
1Single-User Mode
2Multi-User Mode
3Multi-User Mode with Networking
4Undefined
5X11
6Reboot

RHEL 6

By executing command runlevel in RHEL6. You can find the current run level.

runlevel

If you want to check change the runlevel permanently . Then need to edit /etc/inittab

vi  /etc/inittab

Now your runlevel will be permanent.

Be very careful when editing /etc/inittab Simple typos can cause the system to become unbootable.

Want to change runlevel from terminal? Let say if you want to change to runlevel 3

init 3

RHEL 7 & RHEL 8

By executing command runlevel in RHEL7. You can find the default run level.

systemctl get-default

In order to change default target:

systemctl set-default graphical.target
rm '/etc/systemd/system/default.target'
ln -s'/usr/lib/systemd/system/graphical.target''/etc/systemd/system/default.target

Runlevel change in RHEL 7 :

Switch to ‘runlevel 3′ by running

systemctl isolate multi-user.target

Switch to ‘runlevel 5′ by running

systemctl isolate graphical.target
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.