• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

runlevel Command Examples in Linux

by admin

The output of the runlevel command will indicate your previous and current runlevel separated by a single space. If there was no previous runlevel ‘N’ will be used as a placeholder.

For example:

# runlevel
N 5

The output above indicates that the current runlevel is 5 and there was no previous runlevel.

Below is the list of what each runlevel values are defined as:

  • 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

runlevel Command Examples

1. To see the current runlevel:

# runlevel 

2. To suppress the output:

# runlevel -q
# runlevel --quiet 

3. To run in verbose mode:

# runlevel -v
# runlevel --verbose 

4. To get the version info:

# runlevel --version 

5. To get the help:

# runlevel --help 

FAQ on runlevel

Is there a standard runlevel that most people run after installation?

It depends on the requirement of the user, most of the times servers runs on runlevel 3 and desktop’s on runlevel 5. Runlevel 5 is ideal for a desktop workstation. And runlevel 3 is ideal for production.

Does running runlevel 5 consume a lot more resources than runlevel 3?

The only difference in runlevel 3 and runlevel 5 is that runlevel 5 includes X11 (GUI) service along with all other services like firewall, nfs, rpc ntpd etc.

Is there a way to shutdown X once you are done?

You can eaither logout the user under system menu, of you can go back to the console (CTRL+ALT+F1..7) and press CTRL+x to terminate the X session.

Over all, is there any benefit to running one runlevel over another?

To have one runlevel over other is beneficial in the way to implement GUI related application and have testing in the same environment without much load on server. for example Change your monitor or video card and you can run the the tools to adjust without having to try to stop the boot sequence and test it fully and if any problems just kill the GUI and try again, if some combination does cause the X server to lockup, you can kill X without having to reboot the system.

Conclusion

The /etc/inittab file defines the default runlevel for a system. The processes that start for specific runlevels are defined in subdirectories of the /etc/rc.d directory. You can view the current runlevel at any time using the runlevel command:

$ runlevel
N 5

Filed Under: Linux

Some more articles you might also be interested in …

  1. swapon and swapoff Command Examples in Linux
  2. chars: Display names and codes for various ASCII and Unicode characters and code points
  3. dcfldd: Enhanced version of dd for forensics and security
  4. Linux Interview Questions – Basic File and Directory Permissions
  5. How to mount USB flash drive in Linux
  6. cryfs: A cryptographic filesystem for the cloud
  7. i3 Command Examples in Linux
  8. lscpu Command Examples in Linux
  9. husky Command Examples
  10. 10 useful cron examples to schedule jobs in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright