• Aucun résultat trouvé

Miscellaneous things you ought to know

Dans le document Prepared exclusively for J.S. Ash (Page 57-63)

Here’s a selection of topics that it might benefit you to know when trying some of these tips, but which I have been unable to mention above.

Understanding disk partitioning

When you installed Ubuntu you probably repartitioned your disk. The hard disk partition containing Windows was shrunk and two new par-titions were created alongside it for Ubuntu: root and swap. The root partition is simply Ubuntu’s main partition where all the data is stored.

The swap partition is the same as the swap file under Windows (some-times known as the paging file), except that it is housed within its own

MISCELLANEOUS THINGS YOU OUGHT TO KNOW 58

Figure 2.14: Changing file/folder ownerships

partition.14

What’s important to many tips inUbuntu Kung Fu is how Ubuntu refers to the partitions. Every item of your PC’s hardware under Ubuntu is represented as a virtual file in the/dev folder. If you installed Ubuntu in the standard way, opting for default installation choices and dual-booting with Windows, the Windows partition is referred to on a techni-cal level as /dev/sda1, while Ubuntu’s root partition is usually referred to as /dev/sda5 (assuming you’re using Ubuntu 8.04 Hardy Heron or later).15

14.Actually, the swap partition is not exactly the same as Windows’ swap file. The swap partition is also used to hold the RAM contents when the hibernation power saving mode is used. This is why the swap partition will always be the same size as your RAM, or larger.

15.The installer of Ubuntu 8.04 (and later versions of Ubuntu) first shrinks the Win-dows primary partition and then creates an extended partition for Ubuntu’s root and swap partitions. This explains why the root and swap partitions are numberedsda5and

MISCELLANEOUS THINGS YOU OUGHT TO KNOW 59

Figure 2.15: Checking to see how the hard disk is referred to

However, your computermightrefer to the Windows partition as/dev/hda1 and Ubuntu’s root partition/dev/hda5. The only difference is that the

“s” is swapped for an “h”. This difference in nomenclature is simply down to what hardware drivers are used for the motherboard chipset;

there’s absolutely no other significance in the case of a standard desk-top or notebook computer.

To find out which side of the fence your PC sits on, open a terminal window and typels /dev/hda1. If you see the following error message:

ls: cannot access /dev/hda1: No such file or directory

...then your computer uses the/dev/sdareferences. See Figure2.15for an example. If you see a file listed, and no error message, then your computer uses the/dev/hdareferences. If that’s the case you will have to do some substituting when reading the tips—every time you read /dev/sda, regardless of the number that follows, you will have to type /dev/hda.

sda6respectively, rather than simplysda2and sda3, as is the case with earlier releases of Ubuntu, where the root and swap partitions were created as additional primary parti-tions.

MISCELLANEOUS THINGS YOU OUGHT TO KNOW 60

For example, Tip 223, on page 258, explains how to fix file system errors. At one point you’re told to type sudo fsck.ext3 -f /dev/sda5 into a terminal window. If your computer is one of those that refers to the hard disk partitions as/dev/hda, you would have to typesudo fsck.ext3 -f /dev/hda5(incidentally, don’t try this command without reading the tip first!).

If you installed Ubuntu on a computer that had no operating system, Ubuntu’s root partition will be the first on the disk, so will be identified as/dev/sda1(or, of course,/dev/hda1).

The boot loader software used under Ubuntu, known as GRUB, counts hard disk partitions not from 1 upwards, but from 0. So it would refer to /dev/sda5 as the fourth partition. On a dual-boot system with both Windows and Ubuntu installed on the hard disk, in the language used in the GRUB configuration file (hd0,4) refers to the Ubuntu root parti-tion on most systems with Windows installed alongside. The Windows partition will be referred to as (hd0,0). If Windows isn’t installed then Ubuntu’s root partition will be referred to as (hd0,0). It doesn’t matter to GRUB whether Linux refers to your hard disk assdaorhda.

Watching out for Wubi

From Ubuntu 8.04 onwards, it’s possible to install Ubuntu within the existing Windows file system if you intend dual-boot, thus avoiding repartitioning the disk. Effectively, the Ubuntu partitions (root and swap) are created as large files within the Windows file system.

However, aside from possibly being a little slower in operation, there is not much difference between a Wubi and standard Windows installa-tion. The user chooses between Windows and Ubuntu at boot-up, using the standard Windows boot menu, after which the Ubuntu boot menu appears as usual and everything that follows is the same as a standard Ubuntu session.

The main difference for readers of this book is that the tips in this book that talk about manipulating partitions won’t apply. Nor will those that talk about accessing the Windows partition, because this is off-limits due to how Wubi operates.

Getting help if you need it

Help is never far away when you’re using Ubuntu. I mentioned the man command earlier in this chapter. Other built-in documentation

MISCELLANEOUS THINGS YOU OUGHT TO KNOW 61

worth reading is that contained in /usr/share/doc/. There you’ll find a folder for virtually each piece of software installed on the system, and, if you’re lucky, inside will be a READMEfile that will run-through what the software does and how it can be used. This file can be read using the less command, or opened in Gedit.16 The README is usually more informal and not as strictly technical asmanpages. There are usually several other files in the folder relating to copyright and authorship, but the one other file worth reading—if present—is README.Debian, which contains specific information about how the program is configured to run on your system.

As always, the Internet can be a gold mine of information. Your first port of call should be theUbuntu Kung Fucommunity site—http://www.

ubuntukungfu.org, where you can talk to other readers and, if he’s around, the author of this book. Other than this, the primary source of help for all Ubuntu users is undoubtedly http://ubuntuforums.org, which is the official meeting place for the Ubuntu community. Another forum worth visiting ishttp://www.linuxquestions.orgwhich, while catering to all rendi-tions of Linux, has a very strong Ubuntu section.

Command-line text editors

There was a time when discussing command-line text editors was the equivalent of walking into a lion’s den wearing a shirt made of bacon.

This was due to the intense rivalry between advocates of theemacsand vitext editors.

But I’m not going to recommend either. If it’s ever the case that you can’t use Gedit to edit a configuration file, I advise you usenano. Although it runs at the command-line, nanois not a million miles away from old-fashioned word processors you might have used. The cursor keys nav-igate around the text and you can hit Backspace or Delete to remove text. To insert a new line, just go to the end of an existing one and hit

Enter.

To save the file, hit Ctrl+o (not Ctrl+s). Check the filename is correct and then hit Enter. To quit the program, hit Ctrl+x. If you’ve made any changes since you last saved, you’ll be prompted to “Save modified buffer”. This is just another way of asking if you want to save the file.

Hit y to do so, or n if you want to abandon your changes.

16.Some README files are gzipped, so have the.gzfile extension, but these can still be read usingless—decompression of the file is handled automatically.

Chapter 3

The tips

The following pages—in fact, pretty much the rest of the book—contains the 300+ hints, hacks, techniques, tips, and tricks that make up the meat of Ubuntu Kung Fu. They’re arranged randomly, although if one tip builds on another then it will be listed immediately afterward.

Some seemingly disparate tips make reference to others too, and if you’re reading the PDF or HTML version of this book then you can click on the relevant link to jump to that particular tip. If you’re read-ing the dead-tree version you’ve no choice but to wet your thumb and start turning pages (pending a truly amazing technical breakthrough from Pragmatic Programmer’s secret lab, of course).

The tips were written using Ubuntu 8.04.1 LTS (Hardy Heron) as a base. Most tips are version-agnostic and will work on all versions of Ubuntu. However, a little common-sense on behalf of the reader might be required if she/he is using a future release of Ubuntu.

1 Set any picture as wallpaper with a single-click

The easiest way of setting your own picture as a desktop wallpaper is to click and drag the image to the desktop using the middle mouse button (if the image is already on the desktop then click and drag it a few inches to the left/right). On most modern mice, the middle mouse button is the scroll-wheel, which also doubles as a third mouse button.

SEE(AND REUSE)THE MOST RECENTLY TYPED COMMANDS 63

On the menu that appears when you release the button, click Set as Background.

If that sounds a little too unorthodox for you (it can be hard to use the middle mouse button), you can also use Synaptic to install the nautilus-wallpaper package, which adds a simple Set as Wallpaper option to the menu that appears when you right-click an image file. After installa-tion you’ll need to log out and then in again before the opinstalla-tion becomes visible.

For more wallpaper-related enhancements to Ubuntu, see Tip 139, on page 180; Tip 144, on page 187; Tip 199, on page 237; Tip 237, on page279; and Tip290, on page338.

2 See (and reuse) the most

Dans le document Prepared exclusively for J.S. Ash (Page 57-63)