Tag Archive for 'Ubuntu'

Page 2 of 2

Advanced Bash Completion

Ubuntu has a lot of advanced bash completion features that simplify using the shell. For example, when using the ssh command, I can tab complete server names based on my host file and my ssh config file. It turns out that most of this is accomplished with one bash_completion script. This page has a lot of useful information about the Bash shell and also the very useful script. I’ve found that when I use Fedora in the Xinu lab, I am left typing a lot of this stuff myself. Since I use the same bashrc file on both Dakara and my lab machine (Kastria), I didn’t want to always resource the file so I added this to my bashrc:

# Source global definitions
[ -f /etc/bashrc ]      && source /etc/bashrc
[ -f /etc/bash.bashrc ] && source /etc/bash.bashrc
# enable programmable completion features
if [ -z "$BASH_COMPLETION" \
    -a -r ~/.configuration/bash/bash_completion.caliban ]; then
    BASH_COMPLETION=~/.configuration/bash/bash_completion.caliban
    source $BASH_COMPLETION
fi

First, I source the global definitions, Ubuntu uses /etc/bashrc, and Fedora uses /etc/bash.bashrc. After that, if the bash_completion script was already sourced, $BASH_COMPLETION will be set. I check to see if it is zero length (-z) and then source my own copy of it if it is. Now I have advanced bash completion on both Ubuntu and Fedora.

Grub Boot Issues

A while back, I updated one of my servers (Abydos) from Ubuntu 8.0.4 Server to Ubuntu 8.10 Server. That process was pretty easy, but when I rebooted, it failed to boot. I simply selected another kernel version from the boot menu and forgot about it. Then Ben ran into the same issue when he updated his desktop (Loki). I decided to learn a little bit about Grub.

It turns out that fixing the problem is pretty simple. The file to change is /boot/grub/menu.lst, and it contains a default line:

default         0

and a bunch of title lines:

title           Ubuntu 8.10, kernel 2.6.27-9-generic
title           Ubuntu 8.10, kernel 2.6.27-9-generic (recovery mode)
title           Ubuntu 8.10, kernel 2.6.24-19-generic
title           Ubuntu 8.10, kernel 2.6.24-19-generic (recovery mode)
title           Ubuntu 8.10, memtest86+

Grub uses zero based indexing, so I changed default from 0 to 2. It’s as simple as that.

Welcome

Welcome to the Lundscape blog. My brother Ben and I plan on using this blog to document our use of the Linux operating system. I made Ubuntu Linux my primary operating system sometime in May, and Ben switched to Ubuntu Linux in August.