BUY THIS BOOK
Add to Cart

Print Book $29.99


Add to Cart

PDF $23.99

Safari Books Online

What is this?

Add to UK Cart

Print Book £20.99

What is this?

Looking to Reprint or License this content?


Ubuntu Hacks
Ubuntu Hacks Tips & Tools for Exploring, Using, and Tuning Linux

By Kyle Rankin, Jonathan Oxer, Bill Childers
Book Price: $29.99 USD
£20.99 GBP
PDF Price: $23.99

Cover | Table of Contents | Colophon


Table of Contents

Chapter 1: Getting Started
An operating system takes some getting used to. Whether you are new to Ubuntu or new to Linux itself, there are some basic things you need to get familiar with before you can move on. The hacks in this chapter cover those basics and then some.
The Ubuntu Live CD is a good way to explore Ubuntu without changing anything on your hard drive. This chapter explains how to get up and running with the Live CD, and even shows you how to use it with a memory stick to keep your settings and documents around between reboots. You'll also learn how to install Ubuntu, whether you want to make it the sole operating system on your computer or want to dual-boot between Ubuntu and Windows. You'll even learn how to install Ubuntu on a Macintosh.
This chapter also covers fundamentals such as getting your printer set up, getting help (and helping Ubuntu by submitting bug reports), getting started with the command line, and finding the most important applications you need to start "doing stuff" with Ubuntu.
Use the Ubuntu Live CD to get to know Linux before installing it on your system. This is simply the fastest and safest way to try out Linux.
Though Linux on the desktop looks and behaves a lot like Windows, the simple fact is it isn't. Your favorite Windows programs probably won't run in Linux, it may be difficult to migrate data from your Windows install [Hack #7], and the years you've spent getting used to how Windows does things will prove mostly useless when it comes to understanding how Linux works. With all of this in mind, wouldn't it be great if you could try out Linux without spending hours or days getting it installed and configured on your system? Well, you can. With the Ubuntu Live CD, you can take Linux for a test-drive to be certain you really want to commit the time and resources to running it full-time. This hack shows you how to download the Ubuntu Live CD and boot your system using it. Other hacks in the book show you how to get around in GNOME [Hack #15] or KDE [Hack #16], the two popular graphical environments that run on top of Linux.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Test-Drive Ubuntu
Use the Ubuntu Live CD to get to know Linux before installing it on your system. This is simply the fastest and safest way to try out Linux.
Though Linux on the desktop looks and behaves a lot like Windows, the simple fact is it isn't. Your favorite Windows programs probably won't run in Linux, it may be difficult to migrate data from your Windows install [Hack #7], and the years you've spent getting used to how Windows does things will prove mostly useless when it comes to understanding how Linux works. With all of this in mind, wouldn't it be great if you could try out Linux without spending hours or days getting it installed and configured on your system? Well, you can. With the Ubuntu Live CD, you can take Linux for a test-drive to be certain you really want to commit the time and resources to running it full-time. This hack shows you how to download the Ubuntu Live CD and boot your system using it. Other hacks in the book show you how to get around in GNOME [Hack #15] or KDE [Hack #16], the two popular graphical environments that run on top of Linux.
A live CD is a complete installation of Linux that runs entirely from CD. While you are using a live CD, nothing is written to your hard drive, so your Windows or Mac OS installation is not affected in any way. However, because you're running from a CD, you're limited to using only the programs that are installed on the CD, and everything will run a bit slower because CD access is much slower than that of a hard drive. Still, even with these limitations, it's undeniable that a live CD is the easiest way to try out Ubuntu.
You can obtain the Ubuntu Live CD from the main Ubuntu web site (http://www.ubuntulinux.org). There is a convenient Download link that takes you right to the download page to get the latest released version of Ubuntu. This hack, indeed this entire book, was written for the Dapper Drake release—version 6.06, LTS—because it is the release that will be supported for the next five years (previous Ubuntu releases were supported for only 12 months). Ubuntu versions are numbered according to the year and month of release; therefore, this version of Dapper Drake was released in June 2006. Regardless of which version you download, the hacks in this book should be valid for a long time to come.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Get Help
Find out where to get more help on using Ubuntu. Forums, Wikis, IRC chat rooms, and a built-in help system stand at the ready.
Everybody needs a place to turn to when he gets stuck. One of the nice things about Ubuntu Linux is the amount of help you can receive, if you know where to look. The development team at Canonical has put together an excellent support infrastructure that includes both free and nonfree support solutions.
Your first stop on the support train should be the Ubuntu Support page at http://www.ubuntulinux.org/support. This page contains links for all the currently possible support methods, both official and unofficial, paid-for and free.
Of course, Ubuntu has excellent documentation. The official documentation effort at http://help.ubuntu.com has both a Quick Tour section and a comprehensive Start Guide. The Quick Tour page is a great flyer that advertises the high points of Ubuntu and shows off some screenshots, while the Start Guide is more of an overall how-to document.
The next place to visit if you're stuck should be the Ubuntu Wiki (https://wiki.ubuntu.com). The Wiki is extremely comprehensive and is constantly updated by Ubuntu users and developers. As a result, it's typically more up-to-date than the official documentation. One of the side benefits to the Ubuntu Wiki is the Laptop Testing area at https://wiki.ubuntu.com/LaptopTestingTeam. If you're about to install Ubuntu on a laptop, you might want to see if your model is on that page, since the Laptop Testing Team puts all its installation notes and tweaks on that area of the Wiki. It might save you a lot of work and could very well help you get a troublesome feature like wireless or power management working correctly under Ubuntu Linux.
If you have a question that you can't find the answer to, you can ask it in either the Ubuntu Forums or the Ubuntu IRC chat room. The Ubuntu Forums at
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Make Live CD Data Persistent
Take your desktop with you on a USB stick and access it anywhere with the Ubuntu Live CD.
Wouldn't it be handy if you could walk up to any random computer, insert a copy of the Ubuntu Live CD, plug in a USB key, boot it up, and have a fully working system with your own documents, settings, and programs—without modifying the computer in any way?
A little-known feature of the Ubuntu Dapper Drake Live CD allows you to do exactly that. When it starts up, it searches for a volume that has been given the label casper-cow and uses it to store documents, themes, and even extra programs that you install. This is far more powerful than just booting up a live CD and mounting a memory stick as your home directory because it's not restricted to just storing your documents. It gives you the flexibility of a fully installed system, while retaining the "go anywhere" feature of a live CD.
You can perform this trick with just about any storage device, including removable USB hard disks and compact flash drives, but for this hack we use a USB memory stick because they're cheap, portable, and commonly available in increasingly large capacities.
Connect the USB memory stick to a computer running Ubuntu. Ubuntu will probably mount it automatically, so the first thing to do is to find the device name that it has been assigned. Open Applications→Accessories→Terminal and type the following at the shell prompt:
$ df -h
            
to see a list of mounted volumes. The output should look something like this:
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3              54G   19G   35G  36% /
varrun                506M   84K  506M   1% /var/run
varlock               506M     0  506M   0% /var/lock
udev                  506M  116K  506M   1% /dev
devshm                506M     0  506M   0% /dev/shm
/dev/hda1             221M   28M  181M  14% /boot
/dev/sda1             498M  214M  285M  43% /media/usbdisk
USB storage devices are emulated as SCSI devices by Linux, and you can see the last device is listed as
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Customize the Ubuntu Live CD
Rip, burn, and boot to create a personalized version of the Ubuntu Live CD with your choice of software and documents.
The Ubuntu Live CD [Hack #1] contains a complete Ubuntu installation that can run directly from the CD itself, without needing to be installed onto a hard disk. It's ideal for demonstrating Linux on computers with another operating system installed because after you take the CD out and reboot the computer, it returns to the exact state it was in originally. It's a totally painless way to take Linux for a test run with no risk.
The Live CD is also extremely useful for recovering an unbootable machine: just pop in the Live CD and reboot, and you will have a fully running Linux system from which you can access the internal hard disk, copy files across the network, or do whatever else you need to do to fix the system. And you can even use a memory stick [Hack #3] to store changes made inside the Live CD environment.
The Ubuntu Live CD starts up a full desktop environment that's functionally identical to a standard Ubuntu installation, but perhaps you want a Live CD that contains specific software or documents to suit your environment. For example, you may want to create a Live CD that boots up a machine as a fully configured router and firewall with no hard disk. Or maybe you want a forensics disk preloaded with virus-scanning and network-analysis tools plus the checksums of important files.
No problem. You can create a customized version of the Ubuntu Live CD configured exactly the way you want it.
Building the disk image for the Live CD takes a huge amount of storage, so you'll need up to 5 GB of swap plus at least another 3 GB of disk space for storing the image. You'll also need tools for creating and mounting disk images.

Add extra swap

While the disk image is being compressed, two copies of it are held entirely in memory, so without a huge amount of swap, you won't be able to do the compression necessary to generate the ISO.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Install Ubuntu
Learn how to install Ubuntu on your computer.
If you've given Ubuntu a test-drive [Hack #1], or you're simply ready to dive into it sight unseen, all you need is an installation CD and a computer to install it on, and you can be up and running right away. There are a number of ways you can get an installation CD; if you've got broadband and a CD-R drive, you can probably get your hands on it in under an hour.
Ubuntu will run on just about any current personal computer. If you're using an Intel-compatible PC, it will probably "just work," since the kernel image that Ubuntu uses by default is optimized for the 80386, which means it will also be compatible with systems based on the 486, Pentium, and Pentium Pro, as well as the Pentium II, III, 4, and beyond, including all the other mainstream Intel-compatible CPUs such as the AMD Athlon and Sempron, as well as the Transmeta Crusoe and Efficeon. If your computer can run Windows 95 or later, it can probably run Ubuntu just fine. If you're running an AMD64 system, there is even a special version of Ubuntu you can download.
If you have a G3, G4, or G5 Macintosh, you'll probably be able to run the PowerPC version of Ubuntu. If it can run Mac OS X, it should be able to run Ubuntu. Mac users should see "Install Ubuntu on a Mac" [Hack #8] for complete details.
Although you may have a CPU that's compatible with Ubuntu, you may run into some hardware that doesn't want to play along. Wireless network cards can be particularly tricky, but after you get Ubuntu up and running, there are some tricks [Hacks #41 and #42] you can use to get them working. However, because the Ubuntu installer tries to use the network, I strongly urge you to keep an Ethernet cable handy in case you need to plug your system into a wired network for the install. (Early on, the Ubuntu installer will report which network interfaces it was able to activate, so if you don't see your wireless network adapter listed, it's time to use that Ethernet cable.)
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Dual-Boot Ubuntu and Windows
If you're not ready to give Ubuntu total control over your computer, you can meet it halfway. Learn how to install Ubuntu so you can dual-boot with Windows, even if Windows already owns your entire hard drive.
"Install Ubuntu" [Hack #5] details how to install Ubuntu Linux on your machine as the primary operating system. But what if you're not ready to ditch Windows, or you've got a business requirement to run a certain Windows-only application? A possible solution for you might be to enable your system to dual-boot both Windows and Ubuntu. A dual-boot system has multiple hard disk partitions or hard disks, with each partition or disk containing a complete operating system. Typically, there is a boot loader installed on the first hard disk in the system that lets you choose which operating system to boot when you power on the system.
The Dapper Drake version of Ubuntu supports setting up a dual-boot environment from within the installer. Previous versions also had this capability; however, Dapper's installer automatically shrinks your current Windows partition and makes space available for the Ubuntu installation. Prior to this feature, you had to manually shrink your current Windows partition using tools like PartitionMagic or qtparted.
There are just a couple of preparation steps that must be taken prior to setting up a dual-boot system:
  • Your current Windows partition must be freshly defragmented to ensure that there is a large, contiguous block of free space available to dedicate to Ubuntu.
There are some files that the Windows defragmentation utility can't move, so you may want to try a third-party defragmentation utility, such as Executive Software's Diskeeper (http://www.diskeeper.com/defrag.asp). However, if it's your swap (paging) file that refuses to budge, and you have sufficient memory to run without one, try disabling it (right-click My Computer, choose Properties, select Advanced→Performance→Settings→Advanced→Change, and choose No Paging File), defragmenting your hard drive using the Windows disk defragmenter, and then re-enabling the paging file.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Move Your Windows Data to Ubuntu
Your files, bookmarks, and other settings are locked away in a Windows installation. Learn how to move them over to your new Ubuntu system.
So you're making the big move. You're ready to pack everything up and move from Windows to Ubuntu. The easy part is getting Ubuntu up and running. The trickier part is migrating all your data, which is spread out all over your Windows hard disk. Here's how to pack up all your stuff and make use of it on your new Ubuntu system.
If you're switching from Outlook, you probably won't be able to directly import your mail settings into a Linux mail program. Your best bet is to install Thunderbird (http://www.mozilla.com/thunderbird/) on your Windows machine and import all your Outlook settings into Thunderbird. Once you've done that, you'll more easily be able to export your mail and contacts into formats that Linux mail programs can understand.
If your mail account is on an IMAP server, you won't need to worry about all this exporting and importing. Since IMAP keeps the mail on the server, all you need to do is configure your new mail client with your email server, login, and password information, and all your mail (your inbox and email folders) will appear on the new system. Because IMAP keeps everything on the server, you can access the same email account from multiple servers, and you'll always have the same email messages on each computer. However, if you've moved any mail into local folders, you will need to export and import it.

Transfer Outlook into Thunderbird

Before you transfer your Outlook email into Thunderbird, first make sure that Outlook is set to be the default mail application (if you've been using it for your mail application, it probably is). Open the Control Panel and double-click on Internet Options. Go to the Programs tab and make sure that Microsoft Outlook (or Outlook Express, depending on which one you use) is specified as the email program, and then click OK.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Install Ubuntu on a Mac
Install Ubuntu and Mac OS X on the same machine for the best of both worlds.
Apple hardware has some quirks and differences compared to normal PC machines, but is generally of very high quality and can make a great Ubuntu machine. And with a little extra work, you can set it up to dual-boot for those times you still need to use Mac OS X.
First, get your hands on a copy of the PPC installer for Ubuntu. You can find instructions on downloading and burning Ubuntu disk images in "Install Ubuntu" [Hack #5].
If you want to run your computer dual-boot with both Mac OS X and Ubuntu installed at the same time, you will need to reinstall Mac OS X so that you can repartition your disk safely. If you intend to go for a straight Ubuntu system and don't need Mac OS X anymore, you can skip ahead to "Install Ubuntu."
After backing up any documents or data already installed, put the Mac OS X install CD into the CD-ROM drive and reboot. As the computer reboots, hold down the C key to force it to boot from the CD and start the Mac OS X installer. Once the installer loads, you will be presented with a screen to select your preferred language. Don't select a language yet; instead, go to Installer→Open Disk Utility to open the Mac OS X Disk Utility. On the left of Disk Utility is a pane listing disks and volumes, so select the hard disk on which you intend to install Mac OS X and Linux. Next, click the Partition tab at the top of the right pane. Under Volume Scheme, click the drop-down menu labeled Current and select "2 Partitions." The first partition is going to become your Ubuntu partition, and the second will be used by Mac OS X, so click the central divider between the partitions and drag it to adjust the relative partition sizes to suit your requirements, keeping in mind that Mac OS X requires a minimum of 1.5 GB to install.
Next, click the second partition and select Mac OS Extended (Journaled) as the format. The format of the first partition doesn't matter because you'll be replacing it anyway when Ubuntu is installed.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Set Up Your Printer
Get that printer connected, up, and running with Ubuntu.
Ubuntu uses CUPS, the Common Unix Printing System, to manage printers and print queues. CUPS can be configured using a variety of tools, including the GNOME CUPS Manager and its own built-in web interface that runs on port 631.
To launch GNOME CUPS Manager, select System→Administration→Printing, which will display a list of currently installed printers, shown in Figure 1-6, and give you the option of adding a new printer.
Figure 1-6: GNOME CUPS Manager
Double-click the New Printer icon to open the "Add a Printer" window. Here, you need to specify whether your printer is connected directly to your computer or is on your network (see Figure 1-7). If your printer is connected by USB, it's a good idea to use the instructions in "Mount Removable Devices with Persistent Names" [Hack #83]">Figure 1-7). If your printer is connected by USB, it's a good idea to use the instructions in "Mount Removable Devices with Persistent Names" [Hack #83] to assign a permanent name to your printer before going any further; otherwise, it will probably be assigned a different bus ID every time you plug it in, and you will be asked to configure it again each time!
Figure 1-7: Specifying local or network printer
If your printer is connected via the network, you will need to specify the protocol: IPP (Internet Printing Protocol), SMB (Windows printer sharing), LPD (Line Printer Daemon), or HP JetDirect. Each of those protocols in turn provides a number of configuration options to specify the printer identity. In Figure 1-8, the printer is connected to the second port on a network print server using IPP.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Install Ubuntu on an External Drive
You can, in fact, install, boot, and run Ubuntu completely from a FireWire, USB, or other external drive, but it does require some special steps. This hack walks you through the process from start to finish.
In the process of working on this book, we realized one disadvantage to using a laptop as a primary computer: it is much more difficult to swap out hard drives for test systems. We wanted to set up an Ubuntu system so that we could test various hacks on a vanilla install, but we didn't necessarily want to repartition and install on the main laptop hard drive if we didn't have to. The solution was to install and run Ubuntu from an external USB drive we had; that way, the regular system stayed intact but we could boot Ubuntu whenever we wanted.
Unfortunately, this sort of install does not automatically work without some tweaking due to a few different reasons:
  • By default, the initrd (initial ram disk) file that Ubuntu uses does not contain all of the drivers you need to boot from a removable drive. Your BIOS will find the drive fine (provided it supports booting from removable drives), but once the kernel loads, Linux won't be able to see or mount the drive to continue the boot process.
  • Even if the initrd has the appropriate drivers, it takes a few seconds for the kernel to load these modules and detect your removable drive before it tries to use it. During this time, the system will likely try to boot and will not be able to find the removable drive because it hasn't finished configuring.
  • The Ubuntu installer is very handy in that it tries to detect other OSes you might have installed on the system and will provide GRUB menu entries for each OS. Unfortunately, this means that it will set up any OS you have on the internal hard drive as being on the first BIOS drive, with the removable drive being second (or third or fourth if you have other drives on the system). When the BIOS boots from the removable drive, it will configure it as the first drive on the system, which will confuse GRUB.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Install from a Network Boot Server
Boot your computer directly off a network server and install Ubuntu without using a CD.
Most modern computers can search the network for a boot server and load the operating system from it without using a local hard disk. This feature is typically used to boot thin clients that may not contain a hard disk at all, but you can also use it as a clever way to start the Ubuntu installation process without needing an install CD. This hack is perfect if you want to install Ubuntu onto a subnotebook with no CD-ROM drive or need to set up a large number of computers for a cluster, lab, or server farm.
The first step is to prepare the PXE boot server that will dish up the Ubuntu install image to your client. The easiest way to set this up is with an existing Linux server you have kicking around.
This boot server stores the install image and provides DHCP and TFTP (trivial FTP) services so that computers on the network can find and load the image when they start up. The whole process is triggered by the client connecting to the DHCP server and receiving special instructions telling it to fetch its boot image from the TFTP server instead of from the local hard disk.

Configure DHCP

If you don't already have a DHCP server on your network, start by installing the dhcp-server package on the machine that will be your PXE Boot server:
$ sudo apt-get install dhcp-server
               
Then edit /etc/dhcp3/dhcpd/dhcpd.conf and add a stanza similar to this:
host pxeinstall {
  hardware ethernet 00:00:00:00:00:00:00;
  filename "pxelinux.0";
}
Substitute the hardware MAC address of your client's Ethernet card in place of the string of zeros. Strictly speaking, you don't need the hardware line at all, but if you include it, your DHCP server will serve up the boot image only to that specific machine, so you won't need to worry about other random machines picking it up and reinstalling Ubuntu over their existing systems. On the other hand, if you're going to do installs on a lot of machines, you can just leave out that line, and every machine that netboots will be able to run the installer. Once you have updated the config restart the DHCP server:
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Submit a Bug Report
All software has bugs, and Ubuntu is no exception. Here's how you can help improve Ubuntu by submitting a bug report.
It's an unfortunate rule of computing: all software has bugs. The Ubuntu developers and folks at Canonical have done their best to minimize the amount of bugs and their impact in the latest release of Ubuntu, but they can't catch everything. However, one of the major advantages of open source software is that you have an opportunity to help improve the software by filing a bug. The process of filing a bug is surprisingly easy and, despite the name, can be a rather fun and interactive process.
Before you actually go ahead and file a bug, you should run through a little checklist to better assist you in the process. The key thing to remember is that every piece of information you can embed in the bug report will help the people fixing your bug. These people may not have the same hardware as you, and there may be other difficulties in reproducing your bug, so every clue you can provide will help them in solving the mystery.
First, figure out what your problem is, in plain language. Ask yourself what's broken and what the proper behavior should be. Also, is there anything the software is doing that it shouldn't be doing? If you can capture logs or output from a terminal, save that information—you can attach it to the bug. If you have knowledge on how to attach a debugger to your process, you may want to include output from that as well. Ensure you've got the package name of the piece of software you're having trouble with. Save all this information so you can have it handy when it's time to file the bug report.
Ubuntu's method of filing a bug report is via a web-enabled application called Malone (see Figure 1-11). Malone is part of Launchpad (https://launchpad.net/malone/), and the unique thing about Malone compared to other bugtrackers is that Malone tracks not only Ubuntu bugs, but upstream bugs as well as bugs in other distros. This helps to enable another benefit of open source software: the fact that "given enough eyes, all bugs are shallow." In a nutshell, this means that if one distro pinpoints and fixes a bug, all other distros that use Malone can see the fix, and everyone benefits.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Use the Command Line
Put your mouse down for a second, pop open a terminal window, and fall in love with the shell all over again.
If you are used to Windows or Mac desktops, the command line might seem like a foreign thing to you. Typing commands into a window might seem, well, arcane. But even though Linux has really progressed on the desktop, there's still a lot of power you can wield at the command line. If this is your first time with a terminal, this hack will guide you through some command-line basics.
Throughout this book, you'll find a number of places where you'll need to prefix commands with sudo. The sudo command [Hack #67] allows you to temporarily execute a command with different user privileges and is frequently used when you need to add or remove software [Hack #54] from the command line.
The first step is to launch a terminal. Click Applications→Accessories→Terminal to start the default GNOME Terminal program.
Now that the terminal program is open, you can navigate the filesystem. By default, terminals will open into your home directory, so one thing you might want to do is see what files are currently in your home directory. The ls command displays all the files in the directory you specify (or in the current directory if you don't list a directory):
greenfly@ubuntu:~$ ls
Desktop
greenfly@ubuntu:~$ ls Desktop/
screenshot1.png  screenshot2.png
The first command lists all of the files in the home directory. In this case, only the Desktop directory exists. The second example lists the contents of the Desktop directory, where there are two screenshot images.
To change to a different directory, use the cd command followed by the directory to change to:
greenfly@ubuntu:~$ cd Desktop/
greenfly@ubuntu:~/Desktop$ ls
screenshot1.png  screenshot2.png
Notice that the terminal prompt changed in the second line to show that you are currently in the
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Get Productive with Applications
Even the coolest OS is useless without programs to run on it. Ubuntu ships with lots of built-in applications, including many Linux-based counterparts to some of the more common Windows applications.
Ubuntu Linux is great for lots of reasons, but one of its strengths is the amount and type of applications the operating system ships with. If you are a new Ubuntu user, you're probably familiar with Windows and the application suites on that OS. Here's an introduction to the Ubuntu and open source analogues to those Windows-based applications you may use all the time. Feel free to play with these applications; they all have excellent help-based documentation if you get stuck.
One of the most commonly used Windows applications is Microsoft Office. Ubuntu ships with an office suite that's similar, called OpenOffice.org (sometimes called OOo). OpenOffice.org can even read and write Microsoft Office files, so you won't be left out of the loop when a friend or coworker emails you a document attachment. OpenOffice.org includes a word processor (Writer), shown in Figure 1-13; a spreadsheet (Calc); and a presentation tool (Impress). It also includes Math, a scientific formula editor; Draw, a flowchart and drawing program; and Base, a basic database. To access any of these programs, click on the Applications menu and select Office. All the OpenOffice.org applications are there. You can find out more about OpenOffice.org from its web site (http://www.openoffice.org).
Figure 1-13: OpenOffice.Org Writer
Adobe Photoshop is probably the most well-known photo and graphics editor. However, did you know that Ubuntu ships with a world-class graphics editor? This piece of software is called the GIMP (GNU Image Manipulation Program), and it's accessible from the Applications menu, in the graphics section. The GIMP (shown in Figure 1-14) includes many built-in filters for image manipulation and is scriptable using the programming language Python. It's so powerful, it's being used in some Hollywood studios! Surf over to the GIMP's web site (
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Chapter 2: The Linux Desktop
Hacks 15-27
On its own, the X Window System (X11) isn't much of a friendly face. If you've ever run X11 without a window manager, you've no doubt seen it at its barest: a screen filled with a repeating crosshatch pattern, with an X for a mouse cursor. This simplicity does nothing to hint at X11's power, but once you've fired up GNOME, KDE, or any of the many window managers available for Ubuntu, you start to see what it's all about.
This chapter takes you a little deeper into the GNOME and KDE environments, which are so much more than window managers. You'll also learn how to check out some more lightweight window managers in case you're after something simpler and less CPU-intensive.
Once you're settled into your desktop environment, you're going to want to get some work done. This chapter shows you how to install Java, which is needed by many applications, including some of the peer-to-peer (P2P) applications discussed herein. You'll also learn how to connect your handheld Palm or Pocket PC device to Ubuntu, work with remote file servers, and more.
GNOME, the default Ubuntu desktop, is a powerful environment with a lot of features. Here is the information you need to quickly get up to speed on how to customize it.
Recently, the GNOME desktop seems to have lost some features. Looking around on mailing lists and reading people's blogs, you'll often find gripes about how some feature that was someone's personal favorite no longer exists. In reality, GNOME has far more features and configuration options available now than it ever had in the past—they're just hidden from sight, with users shown only the most commonly used options in the standard interface. This has the effect of making GNOME simpler and easier to use for the average person, but it also makes it a prime target for getting under the hood and tweaking the deskop to suit your own tastes if you're an advanced user and want everything to work just the way you like it.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Get Under the Hood of the GNOME Desktop
GNOME, the default Ubuntu desktop, is a powerful environment with a lot of features. Here is the information you need to quickly get up to speed on how to customize it.
Recently, the GNOME desktop seems to have lost some features. Looking around on mailing lists and reading people's blogs, you'll often find gripes about how some feature that was someone's personal favorite no longer exists. In reality, GNOME has far more features and configuration options available now than it ever had in the past—they're just hidden from sight, with users shown only the most commonly used options in the standard interface. This has the effect of making GNOME simpler and easier to use for the average person, but it also makes it a prime target for getting under the hood and tweaking the deskop to suit your own tastes if you're an advanced user and want everything to work just the way you like it.
GNOME provides a central mechanism called GConf for storing user preferences on behalf of individual applications. Instead of writing out their own preferences files and then parsing them again to read values back in, applications can simply use the GConf API. This has a number of benefits, such as the ability to share preference settings among applications and have preferences applied immediately to all running applications.
The GConf database is structured like a simple filesystem, containing keys organized into a tree hierarchy. Each key can be a directory that contains more keys, or it can have an actual value of its own. For example, the key /apps/nautilus/preferences is a key that contains other keys (in a similar manner to a directory), and inside it is the /apps/nautilus/preferences/background_color key with a default value of #ffffff. While keys are expressed as paths, as in a filesystem, they don't actually exist on disk in that way: they are stored in an XML document, with the path representing the nested items within it.
GConf has several tools that you can use to directly browse, query, and manipulate the database using either a GUI or the command line. Configuration Editor provides a very nice graphical interface to the database, but it doesn't appear in Ubuntu's Applications menu by default, so you can launch it from the command line:
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Tweak the KDE Desktop
Get up to speed with configuring KDE, the default desktop environment for the Kubuntu variant of Ubuntu.
While GNOME, the heart of Ubuntu, seems to be adopting an extremist policy of "simplify simplify simplify" that goes so far as to result in the father of Linux strongly criticizing it (see http://mail.gnome.org/archives/usability/2005-December/msg00021.html), KDE, the heart of Kubuntu, has sought to simplify without reducing features. Instead of simply hiding configuration options in the Windows Registry-like GConf or requiring that users know arcane key commands that serve to bring up important capabilities, both of which GNOME practices, KDE preserves the customizability and power that has garnered it fans all over the world, while streamlining options and increasing ease of use.
A prime example of this can be seen in KDE's evolution from the Control Center to System Settings. The Control Center allowed users to customize KDE in virtually infinite ways, but its layout was cluttered and confusing, as shown in Figure 2-3.
Figure 2-3: The old-fashioned KDE Control Center was pretty cluttered
The KDE developers responded to the criticisms they received and are transitioning to System Settings, which is found in Kubuntu (if, for some reason, it wasn't installed on your system, run the command sudo apt-get install kde-systemsettings to install it). As you can see in Figure 2-4, the layout is cleaner, easier to read, and more inviting. To start System Settings, click the K button and choose System Settings.
Figure 2-4: The new and improved KDE System Settings
The infinite customizability is still present, but it's now more approachable for both experts and newbies. Instead of removing features or squirreling them away in byzantine ways, the KDE developers adopted an evolutionary path that improves usability without sacrificing power.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Switch to a Lighter Window Manager
GNOME and KDE are great, but they are a little heavy. If you're on an older system, or you just want a change of pace, you can use other window managers under Ubuntu, such as Fluxbox, XFCE, and Enlightenment.
If there's one thing that's great about Linux, it's choice. If you don't like a particular program, there's a pretty good chance that Linux has at least one alternative. This even applies to your entire desktop environment. The desktop environment comprises a lot of different programs, such as a window manager (which handles drawing borders around your windows, moving them, and so forth), panels so you can launch programs, background-management programs, and more. The most popular of these desktop environments are GNOME and KDE. Ubuntu defaults to GNOME [Hack #15] as its desktop environment but also offers a Kubuntu alternative [Hack #16] that automatically defaults to KDE instead.
If you don't particularly like GNOME or KDE, you still have other options. Linux has a large number of window managers that you can use instead of a full desktop environment such as GNOME or KDE, and all of the popular ones are available for Ubuntu. There are a number of reasons why you might want to give some of these window managers a try:
  • Both GNOME and KDE need a fair amount of resources to run. Most of the alternative window managers require substantially fewer resources, so they might be attractive if you are using an older computer or if you just just want better performance out of your desktop.
  • Alternative window managers often offer a totally different set of features and, in some cases, a different way to look at how to manage your windows. Some of these features include the ability to group windows into a single tabbed window (Fluxbox) or set up lots of fancy eye candy and control your windows' placement to a fine degree (Enlightenment).
If you want to stick with KDE or GNOME, there are some simple things you can do to lighten their resource usage. In KDE, run the program
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Install Java
The modern web-browsing experience requires Java. Here's how to install Java and caffeinate your web browser.
Ubuntu's an amazing Linux distribution for lots of different reasons, but one of the things people find attractive about it is the fact that it ships with lots of different software, preconfigured and ready to use. However, until recently, one of the things that the Ubuntu developers couldn't include was the Sun Java Runtime Environment (JRE), because it used a nonfree license that prevented its bundling with a Linux distribution.
Recently, however, Sun Microsystems relaxed the restrictions on the Java license, introducing the Distro License for Java (DLJ). This new license allows distributors to ship Sun's JRE and Java Development Kit (JDK) as installable packages, rather than the self-extracting binaries that were previously available. It also gives Linux distributors the ability to define the packaging, installation, and support for Java within their Linux distribution.
As such, Dapper Drake now ships with Sun's Java available as a non-free package in the multiverse repository. You'll need to have the universe and multiverse repositories enabled [Hack #60] to install Java.
The Ubuntu developers have separated the Java components into several packages:
sun-java5-bin
Contains the binaries
sun-java5-demo
Contains demos and examples
sun-java5-doc
Contains the documentation
sun-java5-fonts
Contains the Lucida TrueType fonts from the JRE
sun-java5-jdk
Contains the metapackage for the JDK
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Search Your Computer
Have Beagle find and fetch your information faster than you thought possible.
One of Linux's weaker points as a desktop OS has been the lack of a search feature. Nautilus has had a "find this file" function for quite some time, but it's really not much more sophisticated than a GUI wrapper around the command-line find command. Both Nautilus and the find command do similar things: they'll look at each and every file in the directory structure, trying to find a match for the criteria you've given them.
There is a better way to search a filesystem. It involves creating an index of all the files on that filesystem, which enables you to search the index much like you would a database. This is what Windows and Mac OS X do for their file-search capabilities, and now Linux has it too in the form of Beagle, a modular search engine that's written in Mono. It's easy to add Beagle to Ubuntu, and the usability benefits are tremendous.
In this hack, you'll be installing Beagle and a very cool search frontend known as deskbar-applet. deskbar-applet sits in your GNOME panel and enables all manner of search goodness for you. As with many optional goodies, you'll need to have the universe repository enabled [Hack #60] to install both of these packages. Now, open up a terminal [Hack #13] and install beagle and deskbar-applet:
bill@lexington:~$ sudo aptitude install beagle deskbar-applet
            
Once you've got beagle and deskbar-applet installed, you'll need to start beagled (the main engine and database) manually. From a terminal, you'll simply run beagled. It should start and detach from your terminal, and run in the background:
bill@lexington:~$ beagled
            
It will then begin the process of indexing your hard disk(s). This will take a while, depending on the amount and type of data you have. We have seen
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Access Remote Filesystems
Use integrated desktop tools to access a number of different remote network shares.
Let's face it: sometimes it's difficult to fit all of the files you need on a single computer. Whether they be Windows shares at your office, FTP servers somewhere on the Internet, or even machines on the network running SSH, you can access all of these servers and more from the Ubuntu desktop with a few clicks.
The key to connecting to remote filesystems is the "Connect to Server" dialog window. Click Places→Connect to Server to see the default window, shown in Figure 2-15.
Figure 2-15: A sample "Connect to Server" dialog for FTP connections
There are a number of different connection types the dialog supports. Figure 2-16 shows the options available from the drop-down menu. Apart from a few specific options, each of these connection types shares the same sorts of options. The top of the window requests the location of the server (a hostname or IP address), and then below that is a list of nonessential options you can configure. For instance, you can give each of your connections custom names so that they are easier to tell apart from each other.
Figure 2-16: The submenu shows the different types of remote servers you can connect to
Connecting to a Windows share is a good example of how to use the "Connect to Server" dialog. First, select "Windows share" from the drop-down menu. Then, fill in the name of the server you want to connect to and, optionally, the name of the share you want to connect to (Figure 2-17). If your network requires authentication, you can also configure the username and domain name in this window. Once you have configured the share, click the Connect button. A new icon for this share will then appear on your desktop. Double-click that icon to open the Nautilus file browser to that share.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Tweak Your Desktop Like a Pro
Customize your desktop environment, and find a few things you never knew you needed, like a pop-up Quake-style terminal, automatic wallpaper shuffling, and dashboard functionality.
The default Ubuntu GNOME environment is very streamlined and easy to use. Due to its ease of use, however, some of the "power user" features aren't included in the base install. KDE can also benefit from the same tweaking. Here's how to get more usability and features from Ubuntu.
The default Ubuntu Dapper Drake desktop has no icons on it—which gives the system a very clean and simple look. If you're coming from Windows, you may miss the My Computer icon and other desktop icons in that OS. It's relatively simple to add them to Ubuntu; it just requires the use of a configuration editor called gconf-editor [Hack #15].
If you hit Alt-F2, the system will pop up a Run Application dialog. Type gconf-editor in that dialog and click Run. The Gconf configuration program will start. Select "apps" from the left pane; then select "nautilus" and "desktop." In the right pane, you will see several options, like "computer_icon_name" and "computer_icon_visible." If you click on the checkbox next to the "<name>_icon_visible" option (see Figure 2-20), Nautilus will spontaneously add that icon to your desktop. In this fashion, you can add icons for your computer, home directory, network places, documents, and wastebasket.
Figure 2-20: GConf showing the Nautilus icon-configuration options
Tomboy, shown in Figure 2-21, is a tiny application that sits in your panel and acts as an always-on mini Wiki. It's great for making quick notes to yourself without worrying about saving myriad text files or waiting for an editor to start. Much like a Wiki, you can cross-reference the Tomboy notes you make using Wiki-like annotations. Not only that, but the notes are quickly searchable using Tomboy's built-in search capabilities.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Sync Your Palm PDA
Your Palm OS handheld can join in on the Ubuntu fun. Learn how to install applications on your Palm or Treo, keep it in sync with Evolution, and back it up.
Getting a Palm OS PDA to synchronize with Linux has usually involved some amount of effort, and some pain installing and configuring the necessary software. The folks working on Ubuntu have made it easy, however. Ubuntu includes all the software necessary to synchronize your Palm with Evolution and do almost everything you've done under Windows.
Since the Ubuntu and Evolution developers included the gnome-pilot package in Ubuntu, there's no software that needs to be installed. Everything you need is on your system; it just needs to be configured to sync with your Palm.
To begin the configuration process, start Evolution, click on the Edit menu, and select Synchronization Options. The gnome-pilot splash screen will appear (see Figure 2-25). Click on Forward to proceed.
Figure 2-25: The gnome-pilot startup dialog
Next, gnome-pilot displays the Cradle Settings dialog, shown in Figure 2-26. Put values corresponding to your Palm and your system in this dialog box. For instance, USB-equipped Palms will probably sync using port /dev/ttyUSB0 and a speed of 115200, and they will require the USB radio button to be selected. Older, serial Palms will probably need the port set to /dev/ttyS0 and a speed of 57600, and they will need the Serial radio button selected. Click on Forward to continue.
Figure 2-26: The Cradle Settings dialog
Now it's time to identify the Palm (see Figure 2-27). If you've synchronized your Palm with another PC or operating system before, select "Yes, I've used sync software with this pilot before." If you have never synchronized your Palm, select "No, I've never used sync software with this pilot before." If you select No, ensure that your User Name is set to something you'd like the Palm to have embedded in it. The ID string doesn't require any changes or editing. Click on Forward to move to the next step (initial sync).
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Sync Your Pocket PC
Content preview·