Understand runlevels or targets in Linux

Windows Articles

How to enable and disable SMB1/SMB2 in Windows 10

Hello! Windows 10 is an operating system that integrates various protocols to ensure its use with internal and external processes. Indeed, one...

Install Wine 5 on Debian 10

Hi, folks. In this post, I will help you install Wine 5 on Debian 10. Wine is one of...

Is ReactOS a real alternative to Windows?

Oh! The eternal struggle of computer operating systems. Windows vs. GNU/Linux and Mac as a distant spectator However, there are also interesting...

How to install Firebird on Ubuntu 20.04/ 18.04?

Database management systems are sufficient for many kinds of projects. Of course, they abound with MySQL / MariaDB or PostgreSQL popular but...

How to disable Firewall in Windows Server 2019/2016

Hello! The Firewall performs an essential security task on any version of Windows Server. In fact, it has the mission of preventing...

When linux based system start booting. Kernel select one of available target and load services accordingly.
A target is a mode in Centos 7 and Red hat enterprise . systemd is responsible to select the target. A systemd target is same a runlevels in centos6.
systemd target is replacement of “System V init” system. systemd is a system daemon
systemd is designed for better handling of dependencies and has ability to handle more work in parallel at system startup
There are 7 target or levels available in Centos7

Run-level Target Explanation
0 poweroff.target This run level/target is used by systemd to power-off or halt the system
1 rescue.target This run level/target is used by systemd to boot the system in rescue or recovery mode. It is very helpful if some goes wrong you can change the configuration in that mode
2 multi-user.target This run level/target is used by systemd to boot system into multi-user environment so user can work in parallel
3 multi-user.target
4 multi-user.target
5 graphical.target This run level/target is used by systemd to boot system into multi-user graphical environment so user can work in parallel in graphical mode
6 reboot.target This run level/target is used by systemd to reboot the system

 

How to get list to available Targets

[kmehmood@svn-dev ~]$ systemctl list-units --type=target

Note: Above statement will only share list of active available target

Output of above statement

How to get list of available target including inactive

[kmehmood@svn-dev ~]$ systemctl list-units --type=target --all

Note: Above statement will only share list of all available targets

There are two type of default targets
1: multi-user.target
2: graphical.target

How to find default target

[kmehmood@svn-dev ~]$ systemctl get-default
graphical.target

Output of above statement

How to change default mode
Syntax: systemctl set-default target_name

[root@svn-dev ~]# systemctl set-default multi-user.target

Confirm the default runlevel.

[root@svn-dev ~]# systemctl get-default
multi-user.target

Reboot and check it out.

[root@svn-dev ~]# reboot

we can also check target levels available

[kmehmood@svn-dev ~]$ ls /lib/systemd/system/runlevel*target -l
lrwxrwxrwx. 1 root root 15 Jan 23 19:10 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Jan 23 19:10 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Jan 23 19:10 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Jan 23 19:10 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Jan 23 19:10 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Jan 23 19:10 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Jan 23 19:10 /lib/systemd/system/runlevel6.target -> reboot.target

output

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to enable and disable SMB1/SMB2 in Windows 10

Hello! Windows 10 is an operating system that integrates various protocols to ensure its use with internal and external processes. Indeed, one...

Install Wine 5 on Debian 10

Hi, folks. In this post, I will help you install Wine 5 on Debian 10. Wine is one of...

Is ReactOS a real alternative to Windows?

Oh! The eternal struggle of computer operating systems. Windows vs. GNU/Linux and Mac as a distant spectator However, there are also interesting...

How to install Firebird on Ubuntu 20.04/ 18.04?

Database management systems are sufficient for many kinds of projects. Of course, they abound with MySQL / MariaDB or PostgreSQL popular but...

How to disable Firewall in Windows Server 2019/2016

Hello! The Firewall performs an essential security task on any version of Windows Server. In fact, it has the mission of preventing...