Understand runlevels or targets in Linux

Windows Articles

The best lightweight web browsers

Hi! We currently spend a lot of time in front of the computer connected to the Internet. In fact, it is a...

Install Snowflake (SSH Client) on Ubuntu 20.04

Linux system administrators on servers have a big job behind them. Thanks to them, many of the services or tasks that an...

How to install Trisquel 9.0

A few days ago we talked about the release of Trisquel 9.0, this distro is based on the Ubuntu 18.04 LTS packages....

Learn about the Ramnit threat and how to remove it from Windows 10.

Hello! There are computer security threats that can appear spontaneously. But, then they may not last long. On the other hand, malware...

How to get the Nextcloud desktop client on Linux?

Hello friends. We already know how to install a Nextcloud server but now the client is missing. So in this post, you...
Avatar
Mel Khamlichi
Webmaster and technical Director at Osradar.com Linux/Unix Guru Technology and hardware addicted Location : Amsterdam Netherlands

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

The best lightweight web browsers

Hi! We currently spend a lot of time in front of the computer connected to the Internet. In fact, it is a...

Install Snowflake (SSH Client) on Ubuntu 20.04

Linux system administrators on servers have a big job behind them. Thanks to them, many of the services or tasks that an...

How to install Trisquel 9.0

A few days ago we talked about the release of Trisquel 9.0, this distro is based on the Ubuntu 18.04 LTS packages....

Learn about the Ramnit threat and how to remove it from Windows 10.

Hello! There are computer security threats that can appear spontaneously. But, then they may not last long. On the other hand, malware...

How to get the Nextcloud desktop client on Linux?

Hello friends. We already know how to install a Nextcloud server but now the client is missing. So in this post, you...
x