Category Archives: Linux

Set Windows as the Permanent Default OS when Dual-Booting with Ubuntu

Ubuntu Linux is a great operating system, but one potential annoyance is how it automatically sets itself as the default OS when installed as a dual-boot with Windows. Fortunately, it’s easy to switch it back by editing GRUB (GRand Unified Boot Loader).

To modify GRUB, first boot into Ubuntu, then launch a Terminal (Applications → Accessories → Terminal). Type the following command:

sudo gedit /boot/grub/menu.lst

(Tip: if you don’t want to launch a full text editor, just substitute nano instead of gedit.)

Scan the file until you find this section:

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
# You can specify ‘saved’ instead of a number. In this case, the default entry
# is the entry saved with the command ‘savedefault’.
# WARNING: If you are using dmraid do not use ‘savedefault’ or your
# array will desync and will not let you boot your system.
default 0

The number that follows the word default at the bottom is the critical part. Conventional wisdom suggests that we just have to change the zero to a higher number (usually between 4 and 6). Sure, you can do it that way if you want. Just find the section in your GRUB file at begins with: ### END DEBIAN AUTOMAGIC KERNEL LIST.

Starting with 0, count the entry blocks below that marker to find what the appropriate number is for Windows.

Be warned: the above method is only temporary. The next time a new kernel is passed down through the Update system, GRUB will likely add a new entry for it, breaking your default OS. You may find your computer furiously trying to boot the GRUB divider!

The Permanent Method

To fix that annoying little problem permanently, just type saved instead of a number, so that your GRUB file looks like this (emphasis is mine):

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
# You can specify ‘saved’ instead of a number. In this case, the default entry
# is the entry saved with the command ‘savedefault’.
# WARNING: If you are using dmraid do not use ‘savedefault’ or your
# array will desync and will not let you boot your system.
default saved

The saved option works because Ubuntu so kindly already specifies Windows as the default when this option is invoked. Don’t believe me? Take a look at the very bottom of your GRUB file (emphasis is mine):

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
chainloader +1

Save your GRUB file and reboot. Don’t be alarmed if your computer does not immediately default to Windows. I found that I had to manually switch it to Windows once, but then GRUB remembered my choice after that.

Synchronize Your Ubuntu System Clock with Internet Time Servers

Note: This guide was written for Ubuntu 8.10, but any GNOME-based Linux system should be similar.

If you want your Ubuntu system clock to stay in sync with Internet time servers, follow these simple instructions.

Step 1 – Open Time and Date

Go to the System menu → Administration → Time and Date.

Step 2 – Unlock

Click the Unlock button and enter your password for authorization.

Step 3 – Install NTP

Once unlocked, switch the Configuration from Manual to Keep synchronized with Internet servers.

If NTP (Network Time Protocol) is not installed on your Ubuntu system, you will be prompted to install it.

Curiously, my Time and Date configuration settings remained stuck on Manual until I closed and re-opened it.

Step 4 – Choose Time Server (optional)

The next time you open Time and Date on Ubuntu, you will have the option to select a time server.

The default choice is, though feel free to select a different time server (or add your own).

Pretty neat stuff. May your system clock always stay in sync.

I Hate ID3 tags (Part 2)

I think I finally found a good solution to my dilemma.  The best part is, it’s open source and available for windows, linux, and mac.


I had tried it in its early beta, and decided to try it again.  It can easily do everything iTunes does (except for all the stuff you don’t want iTunes to do).  Any feature it’s missing is typically available as a plugin.  It has some flaws, but they are already set for later releases (such as CD burning, but heck why not just use infra recorder for everything).  Just take a look at the features and “coming soon” section of the page.

Here is the important part:

The Single Most Amazing Plugin Ever. You can set multiple folders for it display in the folder tree, and it is simple to add content to.

When combined with Songbird, it solves all the problems the ID3-tag-hater has.  I also managed to install and uninstall enough plugins that it feels like it was made just for me.

Oh, did I mention it has a web browser built in and is fully skinnable?  I might do a full review in the future, but for now, I’m going to go listen to well organized music that I didn’t have to import into a sloppy music library.

Introduction to Bash Scripting

Here’s a great tutorial for bash scripting:

Linux and OS X: Harness the Power of Bash
Linux and OS X: Harness the Power of Bash

If you’re doing any work with Linux or OS X computers, knowing even a little bit of bash can save you a whole lot of work. You can write automated backup scripts, you can scan for faulty permissions… the list is endless. You’ll end up building a toolbox of common scripts that you will use in multiple places.

Only one thing wasn’t given much attention on that page, so I thought I’d point it out:

for next Loop

Usually, your programming syntax is cleaner if you avoid the for next construct and stick to the for each construct instead, however, with bash scripting you often need to work with that crazy little numerical iterator for changing things like file names (e.g. backup1, backup2, …). So you should get familiar with the seq command. It creates an array, going either forwards or backwards, and then bash’s for next loop iterates over that array.

Here’s the seq syntax:


And here’s how you might iterate backwards over an array:

for I in $LIST; do
echo "I is $I";

Now get over to and start learning.

Fix Common Fedora 10 Linux Issues

I’m a big fan of Fedora Linux and have been a user since the Red Hat days. I cut my Linux teeth on Fedora Core 1 (I still have the install discs). Though I’ve tried many other distros, I tend to return to Fedora.

Fedora 10 was released a few days ago. I just installed it, and decided to address a few common issues typical users may face. A few of you may remember that I did the same thing for Fedora Core 6. Here we go.

For the purposes of this guide, I’m using GNOME on an i686 machine.

Add the RPM Fusion Repository

First and foremost, install the RPM Fusion repository to gain access to a lot more software. You can do it graphically or via the command line (please see their configuration page). Copy and paste the following code into the Terminal:

su -c 'rpm -Uvh'

Don’t skip this step. It makes most of the other steps much simpler. Many of the remaining steps will also utilize the command line, but if you prefer a graphical user interface (GUI), just go to System → Administration → Add/Remove Software. You will get a GUI, like this:

Get Video Working

Alright, the next step is to get video acceleration working. I only own Nvidia cards, and installing the latest Nvidia driver is as easy as:

su -c 'yum install kmod-nvidia'

For ATI cards, try this:

su -c 'yum install kmod-fglrx'

Once it installs, just logout and log back in (or reboot if you really feel like it). To see if the video driver is working, try typing glxgears in the Terminal.

If you see frame-rate numbers in the thousands, you have video acceleration.

Install the Flash player

Let’s get the Adobe Flash player working. There are a few ways to do it, but I suggest using YUM. First, go to this link:

Select YUM for Linux from the drop-down list, and download the RPM.

Double-click to install the RPM. You have now set up a repository for Flash, and all that is left to do is initiate YUM to install it.

su -c 'yum install flash-plugin'

Restart Firefox to enable the Flash player.

Have a Little WINE

If you want to try your hand at running any Windows applications, go ahead and install WINE.

su -c 'yum install wine wine-tools wine-desktop'

Make MP3s Work

As discussed many times, Fedora does not include MP3 playback out of the box for legal reasons. However, enabling MP3 support is trivial. The first time you try to play an MP3, Totem will prompt you to search for the MP3 codec. Provided that you enabled the RPM Fusion repository (as described above), it will find the decoder automatically! Piece of cake!

If you prefer to enable MP3 playback manually, do it like this:

su -c 'yum install gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly'

I prefer using Rhythmbox over Totem as a music player. It is usually installed by default (look under Applications → Sound & Video), but if you do not have it, install Rhythmbox like this:

su -c 'yum install rhythmbox gstreamer'

And DVDs, too

DVDs are a little more tricky. Reading DVDs is no problem. Just do this:

su -c 'yum install lsdvd libdvdread libdvdnav'

However, the problem comes when trying to decrypt an encrypted DVD. This is a legal issue in some countries (such as the USA… sigh). In order to do this, you need the libdvdcss package, and it is currently not in the RPM Fusion repository due to legal responsibility. Maybe it will be added in the future, or maybe there will be a workaround, who knows?

In the meantime, you can install the libdvdcss package like this (from the Livna repository):

su -c 'rpm -ivh'

Install VLC

VLC is an excellent media player that will play almost anything you throw at it.

su -c 'yum install vlc'

Get Thunderbird

Fedora 10 comes with Evolution for a mail client. If you prefer Thunderbird, install it like this:

su -c 'yum install thunderbird'

To make Thunderbird the default Mail program, just go to System → Preferences → Personal → Preferred Applications. From there, select Thunderbird from the drop-down list.

Burn CDs/DVDs with GnomeBaker

As a GNOME user, my favorite tool for burning CDs and DVDs is GnomeBaker.

su -c 'yum install gnomebaker'

Make Nautilus Better

If you like the default behavior of Nautilus, skip this step. Personally, I prefer that Nautilus NOT open every folder in a new window.

To fix this, simply open any folder (such as your Home folder) and go to Edit → Preferences. Click the Behavior tab. Put a check next to Always open in browser windows.

Enable Numlock by Default

su -c 'yum install numlockx'

Now whenever you log in to GNOME, numlock should turn on automatically.

There we go. This guide is by no means comprehensive, but it should help alleviate some of the common issues that the average user faces.

If you want to share any other Fedora 10 tips, or know of a better way to accomplish anything that I have listed, please comment below.

Installing Packages in Linux

I always forget the exact commands required to extracting my little tarballs onto my Linux system after downloading them. But wait! Before you go downloading a tarball, try to download a pre-compiled package using a package management tool like Yum, APT, Aptitude, Pacman, Portage, Yast, etc.. You will save LOTS of time by doing this. However, for the sake of this post, let’s pretend you’ve entered the grim and dark world of un-compiled packages, and now you must must make the sacred journey into adulthood by downloading and compiling your own packages. (There’s still time to back out… are you sure there isn’t a pre-compiled package out there?)

Unpacking a .gz File

For this example, let’s say that you’ve downloaded the file ImageMagick-6.4.4-10.tar.gz (e.g. by using the wget utility or by uploading the package to your Linux server).

tar -zxvf ImageMagick-6.4.4-10.tar.gz

This will extract the file to the current directory.

* You may need preface the commands using the sudo command… as in “sudo make me a sandwich“. You may also want to read the man page: man tar

After Unpacking…

cd into the new directory and read the documentation! It’s a bummer, but when you roll your own stuff here, you gotta RTFM. That’s just part of the sacred ritual. Be glad it’s not adult circumcision we’re talking about.

In a nutshell, the compilation process usually goes a little something like this:

  1. ./configure [with options listed]
  2. make
  3. make install

Each of these steps may take a while… compiling and testing and such. Go get some coffee.

Run as the Root Account

Well, some days you need some tips, some days you need some humor. Today is a day when I need to laugh at something, because I just got a phone call from the Dow Jones Industrial average… it said “go F@#% yourself!” So… the article I’m linking to only makes sense if you know something about Linux, but I thought it was pretty hilarious: Run as Root

Running as root will change your life. People will no longer cut you off in the lunch line, and if you tell someone to go screw themselves, don’t be surprised if they actually do it.

People or Things that Ran as Root

  • Chuck Norris
  • Trogdor
  • That guy who took a picture of himself every day for 6 years
  • Hurricane Katrina
  • The 1968 Toronto Maple Leafs
  • Large Hadron Collidor