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 Level | Mode |
---|---|
0 | Halt |
1 | Single-User Mode |
2 | Multi-User Mode |
3 | Multi-User Mode with Networking |
4 | Undefined |
5 | X11 |
6 | Reboot |
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