How to edit grub.conf file using vi editor on Linux


Sometimes you need to edit grub.conf file for changing the behaviour of Linux systems start up

To change that file, you should apply the following commands for editing grup.conf file

1. Open a terminal

2. apply the following commands

[tuna@localhost ~]$ su –

Password: type password

[root@localhost ~]# vi /boot/grub/grub.conf

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE: You have a /boot partition. This means that

# all kernel and initrd paths are relative to /boot/, eg.

# root (hd0,1)

# kernel /vmlinuz-version ro root=/dev/sda5

# initrd /initrd-version.img

#boot=/dev/sda

default=1

timeout=5

splashimage=(hd0,1)/grub/splash.xpm.gz

hiddenmenu

title Fedora (2.6.27.5-117.fc10.i686)

root (hd0,1)

kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=4e7e082f-78cf-42e2-8842-3dbb4146245d rhgb quiet

initrd /initrd-2.6.27.5-117.fc10.i686.img

title Other

rootnoverify (hd0,0)

chainloader +1

~

~

~

~

~

~

~

~

~

~

“/boot/grub/grub.conf” 20L, 684C

press i here for inserting (INSERT Mode) (changing the grub.conf file)

default attribute of this file should be modified for selecting the default Operating System. In this situation default:1 will start Vista OS first and if I change it to default=0 then Linux(Fedora) operating system will be started first. I can also change the timeout attribute and this will change waiting period in seconds for the boot menu when the computer starts.

After changing grub.conf you should press ESC (Command Mode) first and press : (colon) after

and w(rite) and q(uit) if you need modification

like :wq or just :q if you need no modification on the file

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s