Ready to Start Your Career?

By: Sean Mancini
July 24, 2018
What are Linux Runlevels?

By: Sean Mancini
July 24, 2018

0 | Halt the system. |
1 | Single-user mode (for special administration). |
2 | Local Multi-user with Networking but without network service (like NFS) |
3 | Full Multi-user with Networking |
4 | Not Used |
5 | Full Multi-user with Networking and X Windows (GUI) |
6 | Reboot. |
SYSTEMD
In systemd, the runlevels are slightly different. Runlevels are targets, and in order to enable a target, you will use the systemctl command to enable the target.SYSTEMD Chart
Runlevel 0 is matched by poweroff.target (and runlevel0.target is a symbolic link to poweroff.target).
Runlevel 1 is matched by rescue.target (and runlevel1.target is a symbolic link to rescue.target).
Runlevel 3 is emulated by multi-user.target (and runlevel3.target is a symbolic link to multi-user.target).
Runlevel 5 is emulated by graphical.target (and runlevel5.target is a symbolic link to graphical.target).
Runlevel 6 is emulated by reboot.target (and runlevel6.target is a symbolic link to reboot.target).
Emergency is matched by emergency.target.
Checking the current default runlevel in systemd- systemctl get-default
/etc/init/rc-sysinit.conf
- Ubuntu (Non Systemd)/etc/inittab
- Redhat/Centossudo systemctl enable multi-user.target - SystemD You would definitely NOT want to change your default runlevel to 0 or 6. That would be bad and result in a system that either shuts down right away or reboots right away, which is not very useful.You can also add scripts that run at certain runlevels. If you go to /etc/rc.d/,
you will see folders, such as init.d/ rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/.
You can add scripts to these folders, and the scripts will be called when that runlevel is initiated.You can also change runlevels by running a command in the terminal runlevel 1,2,3 etc .