The command line interface is the most basic GRUB 2 interface, but it is also the one that grants the most control. The command line makes it possible to type any relevant GRUB 2 commands followed by the Enter key to execute them. This interface features some advanced features similar to shell, including Tab key completion based on context, and Ctrl+ a to move to the beginning of a line and Ctrl+ e to move to the end of a line.
Question: I have several kernel images installed on my CentOS box, and I want to change the default boot kernel either permanently or temporarily ('just once'). How can I change the default kernel version used by GRUB/GRUB2 on CentOS? When there are multiple kernels installed on CentOS, GRUB/GRUB2. The Grub bootloader may only show your Linux OS as your only options to boot from. To fix this and have the Grub bootloader list your Windows OS, you need to edit the Grub bootloader files. If you have used CentOS is the past (with 6 or earlier), you may find that editing Grub is different. Previously, you would edit /boot/grub/grub.conf.
![Edit grub centos 7 Edit grub centos 7](/uploads/1/2/5/5/125580985/221395166.png)
In addition, the arrow, Home, End, and Delete keys work as they do in the bash shell.
Question: I have several kernel images installed on my CentOS box, and I want to change the default boot kernel either permanently or temporarily ('just once'). How can I change the default kernel version used by GRUB/GRUB2 on CentOS?When there are multiple kernels installed on CentOS, GRUB/GRUB2 boot loader chooses and loads one of them as the default kernel during boot time. The default kernel can be chosen differently. For example, CentOS can be configured to boot into a newly installed kernel (e.g., CentOS 6), or it can boot a last saved entry regardless of the kernel is newer or older (e.g., CentOS 7).If you want to change the default kernel to a particular kernel version permanently, you can modify GRUB configuration as follows. Change the Default Kernel Version Permanently on CentOS 7First, list all available kernel images added to GRUB2 by running the following command. $ grep '^menuentry' /boot/grub2/grub.cfgIdentify the GRUB menu entry for the kernel that you want to set as default.
Each menu entry is assigned by GRUB2 a numeric value starting from 0 in an increasing order. That is, the first menu entry assigned 0, the second entry assigned 1, etc.
![Edit grub.conf centos 6 Edit grub.conf centos 6](/uploads/1/2/5/5/125580985/552711321.png)
For example, the menu entry value for the kernel 3.10.0-327 is '2' in the above screenshot.Open /etc/default/grub with a text editor, and set GRUBDEFAULT to the numeric entry value for the kernel you chose as the default. In this example, I choose the kernel 3.10.0-327 as the default kernel.GRUBDEFAULT=2Finally, re-generate GRUB configuration. $ sudo grep '^:space:.kernel' /boot/grub/grub.confFrom the list, identify the kernel that you want to set as default. Each kernel in the list is assigned by GRUB a numeric entry value starting from 0 in an increasing order.
That is, the first entry assigned 0, the second entry assigned 1, etc. For example, the kernel 2.6.32-431 is assigned GRUB entry value '1' in the above screenshot.Open /boot/grub/grub.conf with a text editor, look for 'default=N', and change N to the GRUB entry value for the default kernel to use. For example, to set the kernel 2.6.32-431 as the default kernel:default=1Reboot and confirm that the chosen kernel has been booted by default. Change the Default Boot Kernel Temporarily on CentOSOften times you may want to switch to a different kernel just temporarily, not permanently. Even if you do want to change the default kernel permanently, it is a good idea to try a temporary boot to a new kernel before making a permanent transition from the old kernel to a new one. That way, in case there is any kernel crash with the new kernel, you can easily fall back to the old kernel simply by rebooting.Of course you can choose a kernel to boot interactively via GRUB menu.
However, such interactive control is not always available, for example, when you are booting over SSH remotely.Here is how to change the default boot kernel 'temporarily' from the command line. I assume that '2' is the numeric GRUB menu entry value of a kernel that you want to boot into during the next boot session. Replace the number with your own.On CentOS 7.