Jesin's Blog

Welcome to the Portal of Technology

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • Home
  • Categories
    • Domains
    • Linux
    • Networking
    • PHP
    • Virtualization
    • Web Design
    • Web Servers
    • Windows
  • WordPress Plugins
    • Custom Error Pages
    • HTTP Digest Authentication
    • Mailgun Email Validator
  • Toolbox
    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool
  • About Me
  • Contact Me
  • Sitemap
Home ›
Linux ›
How to change the default runlevel in Linux

How to change the default runlevel in Linux

October 27, 2010 Linux Jesin A Leave a Comment

change default runlevel in linux

Linux has several runlevels which are different modes of operations of the Operating System. Each of the runlevel may be selected according to the user’s requirements. For example while installing device drivers it is recommended to be in single user mode. In fact runlevels are required for both shutdown and restart operations. After the installation of Linux Operating System using default settings the system directly starts in GUI mode. But many people prefer starting the command line terminal mode. Even though you can Ctrl+Alt+F1 at the GUI login screen and enter into terminal 1 its cooler and easier to directly startup with your desired runlevel. Change the default runlevel in linux by following the instructions below.

Proceed with caution as you’ll be editing a system file. Don’t skip the backup step. You should have access to the root account or should be on the sudoers list else it is not possible to edit the file. I’ll be outlining the step for command line editing because on most systems you cannot login as a root user in GUI mode.

Step 1: Login as root user from the command line

If you’re on GUI mode press Ctrl+Alt+[F1 to F6] to open a command line terminal enter your credentials. If you login as a normal user make sure you that account is on the sudoers list.

Step 2: Take a backup of the inittab file

It is very important you take a backup of the /etc/inittab file as you can restore it in case you mess up. If your the root user type

cp /etc/inittab /etc/inittab.bak

If your logged in as a user with sudo permission add sudo to the beginning

sudo cp /etc/inittab /etc/inittab.bak

Step 3: Edit the /etc/inittab file in a text editor

Open the /etc/inittab file using a command line text editor like vi, vim or nano whichever is installed. I’ll use vim for this example. Root users use this command

vim /etc/inittab

Sudoers use this command

sudo vim /etc/inittab

Press ‘i’ to enter into insert mode, edit the following line

id:5:initdefault:

Change the number 5 to your preferred value except 0 (halt) or 6 (restart). Press [Esc], [shift+:] type wq hit enter. The changes to the file are saved. Restart your Linux OS by typing init 6 and you should see the necessary changes.

Note:- The shortcut keys explained in step 3 will only apply to vi and vim editors if you’re using some other editor read its manual for the corresponding shortcut keys.

Related posts:

linux password lockout policy thumbnailLinux password lockout policy linux category thumbnailReset Root Password in Linux linux category thumbnailChange Home Directory in Linux linux category thumbnailChange Linux Login banner linux category thumbnailForgot MySQL root user password (Linux)

Tags: linux, linux system files

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get a wealth of information delivered to your inbox. Subscribe and never miss a single article.

  • Tutorials and howtos
  • Code, scripts and commands
  • Online Tools

* No spam, unsubscribe anytime

Hire Me

  • SSL installation and hardening (A+ on Qualys SSL test)
  • Apache & Nginx configuration
  • Email deliverability improvement (10/10 on Mail Tester & MailGenius)
  • WordPress customization, optimization and migration
  • and much more…

    Tools

    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool

    Nav

    • Home
    • About Me
    • Contact Me
    • Privacy Policy
    • Sitemap
    Vultr SSD VPS

    Creative Commons License
    Jesin's Blog by Jesin A is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
    Based on a work at websistent.com.