Linux Power Tools

Choosing the Right FTP Server

FTP is an old protocol, and numerous implementations of it have sprung up over the years. These servers vary in many details however, they all serve the same protocol, and they all look very much alike to their users. FTP server options for Linux include ProFTPd This server, headquartered at http proftpd.org, is one of the more popular of the very complex FTP servers. It ships with most major Linux distributions. Its configuration file is modeled after that of Apache, and the server supports...

Types of Emergency Recovery System

The challenge in creating an emergency recovery system is in putting Linux on a bootable medium that's probably much smaller than a typical Linux system. Fortunately, most emergency recoveries require just a handful of utilities fdisk, filesystem tools, an editor, tar or other backup and recovery tools, and so on. An emergency recovery system doesn't need big programs or sets of programs such as TeX, Mozilla, KDE, or the like. Nonetheless, some emergency recovery systems come on large media and...

Creating a Modeline

The key to X video modes lies in the modeline, which may reside in either the Monitor section of XF86Config (in which case it applies to just one monitor) or in a separate Modes section (in which case any monitor can use it). A typical modeline looks like Modeline 1024x768 98.9 1024 1056 1216 1408 768 782 788 822 -HSync -VSync The first line is a comment that describes the effect of the modeline in this case, it creates a 1024 x 768 display at 85Hz, which is a common video mode. The second line...

NFS Kernel and Package Options

Nfsv4 Feature Set

Every major Linux distribution ships with an NFS server called rpc.nfsd. In most distributions, this server is part of the nfs-utils package, but Debian places it in the nfs-kernel-server package. These standard servers rely on NFS server support that's built into the kernel, as described shortly. Older NFS servers did not rely on this support, and such servers are still available on some distributions. For instance, Debian's nfs-user-server runs entirely in user space without taking advantage...

Checking Network Card Speed

Most Ethernet cards sold today are capable of operating at various speeds, such as 10Mbps or 100Mbps. Such devices typically auto-detect and configure themselves for the best possible speed, although a few older boards require driver parameters to set their speed. If you've got such a board and are operating at a lower speed than you believe your hardware should be using, consult your driver's documentation. Most NICs include a series of light-emitting diodes (LEDs) near their connectors, and...

Creating MP3 or Ogg Vorbis Files

In the past, people have used a variety of media and formats for storing music LP records, cassette tapes, and audio CDs being three of the most popular. Since the late 1990s, a new class of formats has emerged compressed digital audio files, which can be stored on a variety of media for different players. Several specific file formats have emerged to fill this role, but one of the most popular is the Moving Picture Experts Group Layer 3 (MP3) format. A wide variety of hardware and software,...

Identifying Hardware

A chipset is a set of one or more chips that provide a device's core functionality. Typically, a manufacturer purchases a chipset from another company, attaches chips to a circuit board, and sells the product under its own name. Because devices from different manufacturers that use the same chipset require the same driver code, most Linux drivers are named after the chipsets they serve, not the individual device manufacturers. Some manufacturers develop their own chipsets and sell boards based...

Basic X Remote Logins

To understand X in a networked environment, you should first understand a peculiarity of X. Most servers, such as web servers, FTP servers, SSH servers, and so on, run on computers that are at a distance from the user who accesses them. The user sits at a computer that runs a client program. This relationship is reversed for X individuals interact most directly with the server computer. The client may reside on the same computer (in a non-networked configuration) or on a distant system. This...

Selecting a Window Manager

The first piece of a do-it-yourself desktop environment is the window manager. Some newcomers to Linux confuse window managers and desktop environments. In fact, window managers are much more limited programs that handle a much more specific task the maintenance of window borders, window controls, and the display as a whole. Window managers affect the appearance of window title bars and the widgets that enable you to minimize, maximize, and resize windows. Window managers also provide simple...

Using Distribution Specific Tools

SysV startup scripts are very flexible, but they can be awkward to configure. Creating multiple symbolic links and determining the appropriate sequence numbers make the task of changing your servers' startup configurations difficult. For this reason, many distributions ship with tools to help simplify this task. These tools include chkconfig, ntsysv, ksysv, Red Hat's Service Configuration Tool, and YaST. The chkconfig utility is a fairly straightforward command-line tool that ships with...

Linux CDR Example

If you're unfamiliar with Linux CD-R burning, the gentlest introduction is usually to try a GUI tool. Here is how to do the job using X-CD-Roast 1. Start the program by typing xcdroast in an xterm window or by selecting the program from a desktop environment menu. Note The first time you start X-CD-Roast, it may inform you that you lack sufficient privileges. If so, start the program as root, click Setup, click the Users tab, and ensure that Allow All is selected in the Access by Users area...

Selecting a CPU and Related Options

As noted in the earlier section, An Overview of Kernel Options, one of the main areas of the kernel configuration system is the Processor Type and Features menu. This menu includes options that can influence the efficiency of the kernel when run on particular systems Subarchitecture Type This option, which isn't available on 2.4.x kernels, tells the system which of several IA-32 designs the system uses. Most users should select PC-Compatible. Other options apply to exotic IA-32 computers that...

Important and Unimportant Video Card Features

Walk into a computer superstore, or even an office supply store, and you're likely to see shelves stacked with video cards costing 100 or more. What would such an expenditure buy, though Is it really necessary Features that are common on high-end video cards include Fast Video Bus Most video cards sold today use the Accelerated Graphics Port (AGP) bus. This bus was designed for use by high-speed video cards, and modern motherboards include an AGP bus for video cards. Older video cards use the...

Selecting an Appropriate Desktop Environment

Depending on your Linux distribution and installation options, chances are good your system has more than one desktop environment available. The most common desktop environments are KDE The K Desktop Environment (KDE http www.kde.org) is one of the most popular desktop environments for Linux. It's the default desktop environment for Mandrake and SuSE. It's built atop the Qt widget set, and it includes many powerful tools that integrate together very well. It's described in more detail in the...

Recognizing USB Devices

Introduced in the late 1990s, USB took a while to take hold, but it's now become an extremely popular device interface. Some computers, particularly Macintoshes, have discarded RS-232 serial and parallel interfaces entirely in favor of USB ports, which are faster than RS-232 serial ports and more flexible than parallel ports. USB's flexibility, though, comes at a cost Linux requires dozens of distinct drivers to support the many available USB devices. Therefore, configuring USB support can be...

Deleting Files

The rm command deletes (removes) files. Its syntax is shown here rm options files This command accepts many of the same options as cp, In, and mv. Specifically, from Table 5.2, -f, -i, and -r work with rm. Unlike some operating systems' file-deletion tools, rm is permanent Linux doesn't store deleted files in any sort of trash can folder. Chapter 12 provides pointers to tools and utilities you can use to recover deleted files or to implement a holding area to prevent files from being...

Using Gnome Office

GNOME Office (shown in Figure 7.3) is the Borg of office suites it assimilates other projects into its collective, turning each component into just one part of a greater whole. Most GNOME Office projects began life independently, and some still maintain independent web pages. In fact, according to the official GNOME Office website OpenOffice.org is becoming part of GNOME Office. For the moment, though, I think of OpenOffice.org as a separate project. Figure 7.3 GNOME Office is built from...

Converting Graphics to Text OCR

Scanners are fundamentally graphics devices their product is a bitmap graphics stream, which is easily displayed in an X window or saved in a graphics file. Sometimes, though, the purpose of scanning a document is to convert it to text in order to edit it in a word processor, load data into a spreadsheet, or otherwise manipulate it in a nongraphical way. To accomplish this goal, optical character recognition (OCR) programs exist. These programs accept a graphics file as input and generate a...

Setting a KDE Theme

People have wildly varying preferences in terms of the appearance of their desktops, menu buttons, and so on. Therefore, KDE ships with the ability to change the appearance of these elements. The simplest way to do this is to select a theme an integrated set of desktop backgrounds, window manager borders, and so on. To do this, follow these steps 1. Select K Menu O Control Center, K Menu O Configuration O Control Center, or a similar menu item to launch the KDE Control Center. 2. In the index...

Setting the Text Resolution

One key attribute of graphical video modes as used by X is their resolution how many pixels are displayed, both horizontally and vertically. Text mode, too, sets a specific resolution. The combination of this resolution and the size of the characters that make up the font determine how many characters can be displayed on the screen. Therefore, one way to adjust the number of characters displayed on the screen is to adjust the underlying resolution. There are two ways to do this Modifying the...

Web Server Choices for Performance and Security

In March of 2003, a survey conducted by Netcraft (http news.netcraft.com) of active websites showed that Apache ran on 62.51 percent of the web server computers surveyed. Apache's nearest competitor, Microsoft's Internet Information Services (IIS), ran on 27.44 percent of the server computers. (IIS is not available for Linux.) Thus, it should come as no surprise that discussions of web servers in Linux, including most of this chapter, focus on Apache. Nonetheless, there are alternatives to...

Linux CDR Tools

The Linux CD-R-creation process involves three steps 1. Collect source files. You must first collect source files in one location, typically a single subdirectory of your home directory. 2. Create a filesystem. You point a filesystem-creation program, mkisofs, at your source directory. This program generates an ISO-9660 filesystem in an image file. Alternatively, you can create another filesystem in an appropriately sized partition or image file and copy files to that partition or image file....

Providing GUI Remote Access

Although text-mode remote access is a powerful tool with an OS such as Linux that provides a wide array of text-based programs, some applications demand remote GUI access. You can't run programs such as graphics editors via a text-mode login, for instance. In addition, some users aren't comfortable with text-mode tools. For these reasons, Linux provides several GUI remote access tools. One key GUI remote access method is the X Window System (X) itself. Unlike most GUIs, X is inherently...

Choosing a Filesystem for Removable Media

To use a removable disk to its fullest, you must use it in conjunction with a filesystem. Chapter 12 describes filesystems in more detail, including information on the advantages and disadvantages of specific filesystems. Some removable media have unusual features that make using some filesystems necessary and using others inadvisable, though, and these issues deserve attention. Note Tapes are an exception to the filesystem rule tapes are normally accessed raw. Typically, you send a tar or...

Linking VNC to XDMCP

In order to simplify the VNC login procedure and eliminate the need for users to explicitly configure and launch the VNC server, you may want to link VNC to XDMCP. In this configuration, the VNC server's built-in X server contacts the computer's own XDMCP server to present a GUI login prompt using the VNC link to the VNC client. This configuration obviates the need to use a VNC-specific password or user configuration, but it poses certain challenges. Most importantly, you as a system...

Creating a Filesystem for Optimal Performance

Most filesystems support a variety of options that may impact performance. For instance, large allocation blocks can improve performance by reducing fragmentation and the number of operations needed to retrieve an entire file. Some of these options can be set only at filesystem creation time, but some can be changed after the fact. Not all of these features are available in all filesystems. Across all Linux filesystems, important and popular performance-enhancing (or performance-degrading)...

Improving Disk Performance

If Linux isn't running your disks in an optimal mode, you can use hdparm to adjust its settings. In some cases, you can apply driver-specific options to your ATA driver. Finally, one issue of disk performance doesn't relate to speed, but it is important to laptop users energy use. You can configure the disks to spin down when they haven't been accessed for some time, thereby saving energy. Just as hdparm can read disk parameters, it can write them. Table 2.3 summarizes some of the parameters...

Configuring an EMail Client

GUI mail clients frequently launch into configuration screens the first time they're run. If yours doesn't, the configuration tool can be accessed from a menu option, such as Sylpheed's Configuration O Create New Account (see Figure 8.11) or KMail's Settings O Configure KMail. Text-based programs are typically configured through text files, such as Mutt's - .muttrc. Figure 8.11 You must tell your mail reader how to send and receive mail. Figure 8.11 You must tell your mail reader how to send...

Linux DHCP Clients On a Linux client you can type ifconfig ethO

(changing ethO to another interface name, if appropriate). This command produces information on the network interface, including the hardware address (labeled HWaddr) on the first line of the output. This command requires that the interface be activated, although it need not be assigned an IP address. Windows 9x Me DHCP Clients Windows 9x Me provides a network configuration and information tool that you can access by typing WINIPCFG in a DOS prompt window. The result resembles Figure 27.2. Be...

Installing Samba Packages

All major distributions ship with Samba, but they differ in how they break up the package. Some ship separate packages for clients, servers, and common support programs. Others combine two or all three of these packages. Some distributions provide ancillary packages, such as documentation. The distribution-by-distribution details are listed here Debian This distribution provides a shared samba-common package, separate client (smbclient) and server (samba) packages, a samba-doc package holding...

File Recovery Tools

Undelete utilities for Linux are few and far between. The Linux philosophy is that users shouldn't delete files they really don't want to delete, and if they do, they should be restored from backups. Nonetheless, in a pinch there are some tricks you can use to try to recover accidentally deleted files. Note Low-level disk accesses require full read (and often write) privileges to the partition in question. Normally, only root has this access level to hard disks, although ordinary users may have...

Proprietary File Formats

The most common proprietary file format is probably Microsoft Word's format (denoted by a .doc extension). Many businesses run on Microsoft Word if you work with such a business, you'll have to exchange Microsoft Word files. In some fields, the file formats associated with other Microsoft Office components, such as Microsoft Excel (.xls) spreadsheets are equally or more important. Although Microsoft retains tight control over these file formats, most competing programs make at least some effort...

Setting Kernel Options

Because all Linux software runs atop the kernel, the kernel's performance, and hence its optimizations, is particularly important. What's more, the kernel's configuration tools enable you to set its optimizations from a menu. Figure 1.1 shows this menu, obtained by typing make xconfig in the kernel source directory, for a 2.5-series kernel. Figure 1.1 The Linux kernel provides many options related to the CPU. Figure 1.1 The Linux kernel provides many options related to the CPU. The Processor...

Manipulating Photos

Photos taken with digital cameras can frequently benefit from manipulations of various types. gPhoto provides facilities for performing some common manipulations. To make any of these changes, you must download an image into gPhoto and select it by clicking its tab. Changes you can make to photos before saving them include Rotations You can use the Image O Orientation O Rotate Clockwise and Image O Orientation O Rotate Counter-Clockwise menu options, or the Rotate icons, to rotate an image if...

Filesystem Check Options

The main fsck program supports several options, which it passes on to the filesystem-specific programs as necessary. Table 12.2 summarizes these options. You use these options in the following syntax fsck options -t fstype device extra-options Specify the type(s) of filesystem to be checked. You can check multiple filesystems with one command, so fslist can be a comma-separated list of filesystem types. Check every filesystem specified as one to be checked in etc fstab. Skip checking the root...

Modifying the Tripwire Configuration

Tripwire configuration involves two plain-text configuration files, encrypted variants of these plain-text files, and an encrypted database file. You may want to update any of these files. To do so, you must do more than just edit the original configuration files Modifying the Configuration File To modify the configuration file (typically etc tripwire twcfg.txt), you must first edit the original file and then use twadmin to create a new binary file (typically etc tripwire tw.cfg). Type twadmin...

Using Open Officeorg

OpenOffice.org, shown in Figure 7.1, and its commercial twin, Sun's StarOffice, are the closest the Linux world has to Microsoft Office, short of running Microsoft Office in an emulator. One of this suite's strengths is its cross-platform nature it's available for Linux, other Unix-like OSs (most notably Sun's Solaris), and Microsoft Windows. A Mac OS X version is available, but it requires an X server to run. Older versions of StarOffice were also available for OS 2, but OS 2 has been dropped...

Doing Basic Scans

Once scanimage -L has found your scanner, you probably want to begin using the scanner in a more meaningful way. Because SANE is technically an API, not a program, the manner in which you use SANE depends upon the program you use to access it. One detail you may need for some of these programs is the scanner device name. This name isn't merely the device file (in the dev directory tree), although it includes this identifier. The device name is a concatenation of the back-end name, a colon ( ),...

ProFTPd Configuration

ProFTPd is available with many Linux distributions, including Debian, Mandrake, and Slackware. You can install it on other distributions by using another distribution's package or by installing from source code. In either of these cases, though, you'll need to deal with server startup issues, as described in Chapter 22, Running Servers. Most distributions run ProFTPd from a SysV startup script. It can be run from a super server, though, and some configurations (such as Slackware's) run it this...

Recovering Deleted Files

Perhaps the most common type of filesystem problem is files that are accidentally deleted. Users frequently delete the wrong files or delete a file only to discover that it's actually needed. Windows system users may be accustomed to undelete utilities, which scour the disk for recently deleted files in order to recover them. Unfortunately, such tools are rare on Linux. You can make undeletion easier by encouraging the use of special utilities that don't really delete files, but instead place...

Types of Incremental Backup

In describing incremental backup schemes, three major types of backups come into play Full Backup A full backup contains all the files on a system, or at least all the files that are important. (Full backups may deliberately omit the contents of temporary directories such as tmp, for instance.) If you perform only full backups, you can restore anything or everything from the system using just one backup medium or set of media but such backups take the most time and consume the most media space....

Emergency Restore Procedures

Restoring data from a backup is fairly straightforward when your system is fundamentally intact and you just need to recover a handful of lost files you run the backup software in reverse, as it were. For instance, you use tar's -extract command rather than the -create command. In the case of tar, you must specify the files or directories you want to recover on the command line, or else the system will attempt to recover everything. For instance, you might type these commands to restore the...

Creating Incremental Backups with tar

As an example of an incremental backup system, consider creating a backup to a SCSI tape device ( dev stO) using tar. For the purposes of this example, suppose the computer has four partitions root ( ), home, usr, and var. The initial full backup might be accomplished with a command such as this tar cvplf dev stO -listed-incremental var log incr.dat I home I usr var This command backs up all four partitions to dev stO. The -listed-incremental var log incr.dat option tells tar to use var log...

Using tars Features

Because it's the lowest-common-denominator backup tool and because it's used in nonbackup tasks, tar deserves a bit more attention. The basic syntax for this command is tar command qualified file-or-dir This syntax is deceptively simple, because tar supports a very large number of commands and qualifiers, the most important of which are summarized in Tables 17.2 and 17.3, respectively. (Consult the tar man page for a more complete list.) Many qualifiers take options themselves, such as...

Pros and Cons of Optical Media

Optical media include Compact Disc Recordable (CD-R), CD-Rewriteable (CD-RW), and assorted recording Digital Versatile Disc (DVD) variants (DVD-R, DVD+R, DVD-RAM, DVD-RW, and DVD+RW). These media all use optical technologies a laser burns data onto a light-sensitive substrate. The data can be read back by using a laser tuned to a lower power setting. Note Magneto-optical disks, which use a hybrid magnetic and optical recording technology, are also available. From a software perspective, these...

Pros and Cons of Removable Disks

Instead of using tapes, many people use removable disks as backup media. Table 2.5 in Chapter 2 summarizes many of the available removable disk technologies. At the low end, common 3.5-inch floppy disks hold 1,44MB. At the high end, special mounts are available to turn ordinary hard disks into removable media. You can also buy external SCSI, USB, or IEEE-1394 hard disks. One of the prime advantages of removable disks especially removable hard disks is their speed. Modern hard disks can easily...

Using Font Smoothing

Font smoothing, aka anti-aliasing, is a font display technique in which some pixels that fall along the edge of a character are displayed as gray rather than black or white. The effect is that the text appears to be less jagged than it otherwise would. Some people like this effect, but others find that it makes text look blurry. Unfortunately, font smoothing in Linux is quite confusing because several approaches to the task have been developed since XFree86 4.0.2 was released. As a result,...

Reading Non Linux Filesystems in Linux

Typically, any partition you want to access on a regular basis has an entry in etc fstab. Listing 10.3 shows a typical etc fstab file, including definitions for some non-Linux partitions. Each of this file's lines corresponds to a single partition. Each line has six fields, separated by spaces or tabs the device identifier, the mount point, the filesystem, the filesystem options, the dump order, and the filesystem check order. Foreign filesystems have 0 entered for the final two fields, meaning...

Ghostscript Font Management

Linux's printing system has traditionally worked under the assumption that the printer understands PostScript, but most printers sold for the home and small business markets don't meet that requirement. To fill the gap, Linux uses Ghostscript to convert PostScript into a format that the printer understands. Essentially, Ghostscript is a PostScript interpreter that resides on the computer rather than on the printer. As such, Ghostscript is responsible for printer font management. PostScript...

Changing KDEs MIME Type Mappings

If you want to change the application that Konqueror or other KDE applications associate with particular types of files, you need to use KDE's File Associations tool. This tool can be accessed in several ways, including From the main KDE desktop, launch the File Associations tool. In Mandrake 9.1, this option is under K Menu O Configuration O KDE O Components O File Associations. This direct-access method isn't present on all installations, though, or it may fall under another menu path. Launch...

Improving Performance with Compile Time Options

If you compile your own software, you can pass options to the compiler to have it optimize the resulting source code for a specific CPU model. For instance, if you have an Athlon, you might compile your software with Athlon optimizations. For most programs, these optimizations will yield only trivial performance improvements, but for some programs, the benefits can be more important. These critical packages include the Linux kernel, common system libraries such as libc, any CPU-intensive...