This brief guide explains what is a runlevel, how many runlevels are there in Linux and how to check the runlevel in Linux operating systems. Show
What is runlevel?A runlevel is one of the modes that a Unix-based operating system will run in. In other words, a run level is a state of init and the whole system that defines what system services are operating. In Linux Kernel, there are 7 runlevels exists, starting from 0 to 6. The system can be booted into only one runlevel at a time. By default, a system boots either to runlevel 3 or to runlevel 5. Runlevel 3 is CLI, and 5 is GUI. The default runlevel is specified in Using runlevel, we can easily find out whether X is running, or network is operational, and so on. 1. Check the Runlevel In Linux (SysV init)Here is the list of runlevels in Linux distributions,which were distributed with
Now, let us see how to find the runlevels. To find out the system runlevel, open your Terminal and run the following command: $ runlevel Sample output: N 3 In the above output, the letter In newer versions of Say for example, to find out the current runlevel, you need to run: $ echo $RUNLEVEL To find the previous runlevel: $ echo $PREVLEVEL If you'd like to change the RunLevel to something else, edit $ sudo vi /etc/inittab Find and edit entry id:5:initdefault: Save and close the file. Reboot your system to login to your new runlevel. For more details about runlevels, refer man pages. $ man runlevel 2. Check the Runlevel In Linux (Systemd)In recent versions of Linux systems (starting from RHEL 7, Ubuntu 16.04 LTS), the concept of runlevels has been replaced with
Here is the list of
In Linux systems that are using $ systemctl get-default Sample output: graphical.target As you see in the above output, my current runlevel (target in other words) is To view all currently loaded targets, run: $ systemctl list-units --type target Sample output: UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System bluetooth.target loaded active active Bluetooth cryptsetup.target loaded active active Local Encrypted Volumes getty.target loaded active active Login Prompts graphical.target loaded active active Graphical Interface local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems multi-user.target loaded active active Multi-User System network-online.target loaded active active Network is Online network-pre.target loaded active active Network (Pre) network.target loaded active active Network nfs-client.target loaded active active NFS client services nss-lookup.target loaded active active Host and Network Name Lookups nss-user-lookup.target loaded active active User and Group Name Lookups paths.target loaded active active Paths remote-fs-pre.target loaded active active Remote File Systems (Pre) remote-fs.target loaded active active Remote File Systems rpc_pipefs.target loaded active active rpc_pipefs.target rpcbind.target loaded active active RPC Port Mapper slices.target loaded active active Slices sockets.target loaded active active Sockets sound.target loaded active active Sound Card swap.target loaded active active Swap sysinit.target loaded active active System Initialization timers.target loaded active active Timers veritysetup.target loaded active active Local Verity Integrity Protected Volumes LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 26 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'. The above command will show only the active targets. To view all loaded targets (active and inactive), run: $ systemctl list-units --type target --all If you'd like to change the RunLevel to something else, for example $ sudo systemctl set-default runlevel3.target To change to a different target unit in the current session only, run the following command: $ sudo systemctl isolate runlevel3.target For more details, refer $ man systemd Check Linux Runlevel Using 'who' commandAs one of the reader suggested in the comment section below, we can also find the runlevel using $ who -r Sample output:
Hope this helps. Which of the following files is where the default run level is set on some Linux systems?The default runlevel is specified in /etc/inittab file in most Linux operating systems.
Which command is used to check the default run level?Use the runlevel command /sbin/runlevel to find the current and previous runlevel of an operating system. Runlevels zero through six are generally delegated to single-user mode, multi-user mode with and without network services started, system shutdown and system reboot.
Which one of the following commands will shut down a Linux system?To shutdown Linux using the command line: To shutdown the Linux system open a terminal application. Then type “ sudo shutdown -n now ” to shutdown the box. Then wait for some time and the Linux server will poweroff.
Which of the following is the default window manager used by the GNOME version 3 desktop environment?metacity. The Metacity window manager is the default window manager for GNOME.
|