The telinit command enables you to switch the current runlevel of the system. On systemd environments, the telinit command will be translated into the appropriate target request. The runlevel command prints the previous and current runlevel of the system, each separated by a space.
Syntax
The syntax of the telinit command is:
# telinit [options] {runlevel}
If you encounter the below error while running the telinit command:
telinit: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install sysvinit |
Ubuntu | apt-get install upstart-sysv |
Arch Linux | pacman -S systemd-sysvcompat |
Kali Linux | apt-get install sysvinit-core |
CentOS | yum install systemd |
Fedora | dnf install systemd |
Raspbian | apt-get install upstart |
Changing current runlevel using telinit
To change the runlevel for a system without rebooting or changing the /etc/inittab file, execute the following command as the root user:
# telinit [runlevel_value]
With [runlevel_value] having the following values:
0 — Halt 1 — Single-user mode 2 — Not used (user-definable) 3 — Full multi-user mode 4 — Not used (user-definable) 5 — Full multi-user mode (with an X-based login screen) 6 — Reboot