BCE-C712 Linux System Administration

0 of 74 lessons complete (0%)

Starting up and Shutting Down


You don’t have access to this lesson

Please register or sign in to access the course content.

In Unix-like operating systems, “run levels” refer to different states or modes that a system can be in. Each run level corresponds to a specific configuration of system services and resources, which determines which processes are running.

Traditionally, Unix systems use run levels to manage system startup and shutdown. The specific run levels and their meanings can vary between different Unix-like systems, but they typically include the following common levels:

  1. Single-user mode (run level 1): Also known as maintenance mode, this run level is used for system maintenance tasks. In this mode, only a minimal set of services necessary for basic system operation are started, and the system boots to a single-user command line interface.
  2. Multi-user mode (run level 2): Historically, this was used as the default multi-user mode with networking. However, on many modern Unix-like systems, run level 2 is often the same as run level 3.
  3. Multi-user mode with networking (run level 3): This is typically the default mode for many Unix systems. It starts a full multi-user environment with networking capabilities.
  4. Multi-user mode with GUI (run level 4): Some Unix systems use this run level to start a multi-user environment with a graphical user interface (GUI). However, it is not always used, and run levels 2 and 3 may be configured to include GUI environments.
  5. System shutdown/reboot (run level 5): This run level is used to cleanly shut down or reboot the system.
  6. Reboot to firmware (run level 6): This run level is used to reboot the system, and it is typically set up to restart the computer hardware.

Additionally, there are special run levels, such as:

  • 0 (halt): This run level is used to power off the system.
  • S or s (single-user mode): Similar to run level 1, this is used for maintenance tasks but may have slight differences in behavior.

It’s important to note that not all Unix-like systems use run levels in the same way. For example, Linux distributions often use a system called systemd, which uses a different approach to manage services and system states. In systemd, targets serve a similar purpose to run levels.

Keep in mind that the specifics may vary depending on the Unix-like operating system you are using.

How to Use it

  • To check the current run level, simply type runlevel and press Enter.
  • To change the run level, you’ll use a command like sudo telinit <runlevel>. For example, to switch to single-user mode (maintenance mode), you would type sudo telinit 1 and press Enter.
  • To reboot the system, use the command sudo reboot.
  • To power off the system, use the command sudo poweroff.

Remember to exercise caution when using these commands, especially when changing run levels, as it can affect the operation of your system. Always ensure you have saved any important work before making any major system changes.