Run Levels/Targets in Linux

0 1298

Run Levels/Targets in Linux

Welcome guys to our linux tutorial, In this article we will discuss about different runlevels in unix-linux system. We will briefly describe runlevel, its associated configuration file, boot process,stages of boot process and finally we will discuss briefly about each runlevel. These runlevels or modes run system or boot process defined by user/system admin. But in latest version system uses target instead of runlevels so I am going to use both runlevel or target word so don’t confuse.


Runlevels is basically modes in *nix based systems which is initializing operating system. Every runlevel has certain numbers of services started or stopped. This gives user flexibility to run/boot system in different modes( run system with certain services) as per requirements
Init stand for initialization is the program file in *nix operating system. Its run as a daemon and has typically process identity (PID)  1.


Configuration File

/etc/inittab is a configuration file used to setup the default runlevels for *nix system.After the linux system is booted the init program reads this configuration file and determines runlevel set in this file. If user/admin has not specified any runlevel system will boot with default runlevel.  Applications which  are started by init program located in the /etc/rc.d folder, then within this folder there are  separate folders for each runlevel  e.g rc0.d, rc1.d etc. These runlevels or targets are defined in below.

To Change in configuration file is open it in vi editor or any other editor of your own choice .

I am going to open with vi

vi /etc/inittab.

In older version you can change the run level in last line of this file see below example

id:5:initdefault: or id:3:initdefault    #(choose as per your requirement)

In latest version there are only two main targets by default

# analogous to runlevel 3

# analogous to runlevel 5         #(choose as per your requirement)

BOOT Process

There are following stages of boot process.

runlevel or target in linux

Runlevel or Target with Commands

There are seven runlevels in *nix OS and runlevels are identified by numbers.

Init 0

Init 0 is for immediately shutdown system and powers it off you may also use halt and poweroff. Syntax init 0 or poweroff or halt.

[fahmed@faraz ~]$ init 0

[fahmed@faraz ~]$ poweroff

[fahmed@faraz ~]$ halt

Init 1

It is also known as Single-User mode and it is used for system maintenance and root in CLI mode. Syntax init 1. No network interfaces configured

[fahmed@faraz ~]$ init 1

Init 2

Used for without networking in CLI mode and it is multi-user mode. Syntax init 2.

[fahmed@faraz ~]$ init 2

Init 3

It is also used as multi-user mode but with networking in CLI mode. Syntax init 3. this is like normal startup

[fahmed@faraz ~]$ init 3

Init 4

This is an un-defined mode or you can say not in used mode. Syntax init 4.

[fahmed@faraz ~]$ init 4

Init 5

This is a GUI mode. A standard and default runlevel/target  for most *nix OS. Syntax init 5.

[fahmed@faraz ~]$ init 5

Init 6

It is used to restart your system when required and you may also use reboot.

Syntax init 6 or reboot.

[fahmed@faraz ~]$ init 6
[fahmed@faraz ~]$ reboot

NOTE: Don’t set runlevel 0, 1 and 6 as default runlevel. Otherwise you will face the problems.

To check who is logon in system by using command who. Or list of user login by using command who –u.

[fahmed@faraz ~]$ who

fahmed   :0           2016-02-24 06:09 (:0)

fahmed   pts/0        2016-02-24 06:10 (:0)

fahmed   pts/1        2016-02-24 06:10 (

To view current runlevel/target by using command who –r.

[fahmed@faraz ~]$ who -r

run-level 5  2016-02-24 05:33

To view boot system time by using command who –b.

[fahmed@faraz ~]$ who -b

system boot  2016-02-24 05:32

[fahmed@faraz ~]$

For all options by using who –a.

[fahmed@faraz ~]$ who -a

system boot  2016-02-24 05:32

fahmed   ? :0           2016-02-24 06:09   ?          4601 (:0)

run-level 5  2016-02-24 05:33

fahmed   + pts/0        2016-02-24 06:10 00:22        5430 (:0)

fahmed   + pts/1        2016-02-24 06:10   .          5584 (

[fahmed@faraz ~]$


In this tutorial we discussed about runlevels or targets with command init 0 to 6 and who command who –r, who –u, who –a and who –b. Please subscribe our newsletter for new upcoming tutorials.


Join us by subscribing to our newsletter and learn IT subjects for free
We hate spam. Your email address will not be sold or shared with anyone else.

Leave a reply

You must be logged in to post a comment.