Ubuntu Unleashed: 2010 Edition: Covering 9.10 and 10.4

Paperback
from $0.00

Author: Andrew Hudson

ISBN-10: 0672331098

ISBN-13: 9780672331091

Category: Linux

Ubuntu Unleashed 2010 Edition presents comprehensive coverage of the popular Ubuntu Linux distribution. Windows users, Mac users, and Linux enthusiasts have been increasingly turning to Ubuntu for a user-friendly, easy-to-use Linux distribution. This book provides detailed information on installing, using, and administering Ubuntu. You will learn how to set up a workstation or a server, and you will find complete details on Ubuntu’s easy-to-use desktop and productivity software. Ubuntu...

Search in google:

Ubuntu Unleashed 2010 Edition presents comprehensive coverage of thepopular Ubuntu Linux distribution. Windows users, Mac users, and Linux enthusiasts have been increasingly turning to Ubuntu for a user-friendly, easy-to-use Linux distribution.This book provides detailed information on installing, using, and administering Ubuntu. You will learn how to set up a workstation or a server, and you will find complete details on Ubuntu’s easy-to-use desktop and productivity software.Ubuntu Unleashed 2010 Edition includes a range of coverage: From the software you need in your everyday work, such as the OpenOffice.org productivity suite, to how to configure your Linux desktop to run smoothly using multiple printers, shell scripts, and more.For the hardcore Linux enthusiast, there is complete coverage of theX Window system, Linux programming, web server administration, and network administration.Ubuntu 9.10 on DVDDVD includes the full Ubuntu 9.10 distribution for Intel x86 computers as well as the complete OpenOffice.org office suite and hundreds of additional programs and utilities.Free Upgrade!Purchase this book anytime in 2010 and receive a free Ubuntu 10.04 Upgrade Kit by mail (U.S. or Canada only) after Ubuntu 10.04 is released.See inside back cover for details.à Install and configure Ubuntuà Get all your system’s devices and peripherals up and runningà Configure and use the X Window Systemà Manage Linux services and usersà Run a printer serverà Connect to a local network and the Internetà Set up and administer a web server with Apacheà Secure your machine and your network from intrudersà Learn shell scriptingà Share files with Windows users using Sambaà Get productive with OpenOffice.orgà Play games on Linuxà Use Linux multimedia programsà Create and maintain a MySQL databaseà Configure a firewallà Set up an FTP serverà Use Ubuntu’s development and programming toolsà Tune your Ubuntu system for maximum performanceà Learn to manage and compile the kernel and modules

Introduction 1Part I Installation and Configuration1 Installing Ubuntu 11Before You Begin the Installation.................................................................11Researching Your Hardware Specifications .........................................12Installation Options.............................................................................12Planning Partition Strategies ...............................................................12The Boot Loader ..................................................................................13Installing from CD or DVD .................................................................13Step-by-Step Installation...............................................................................13Starting the Install ...............................................................................14First Update..........................................................................................20Wubi–The Easy Installer for Windows ..............................................22Shutting Down ....................................................................................24Reference .......................................................................................................242 Post-Installation Configuration 25Troubleshooting Post-Installation Configuration Problems ........................26The sudo command ......................................................................................27First Update...................................................................................................28Configuring Software Repositories ...............................................................30Installing Graphics Drivers ...........................................................................33Changing Ubuntu’s Look and Feel...............................................................34Changing the Desktop Background ....................................................34Changing Colors..................................................................................35Modifying System Fonts......................................................................36Changing How Menus Look ...............................................................36Visual Effects........................................................................................37Preferred Behaviors .......................................................................................37Preferred Applications .........................................................................37Removable Drives and Media..............................................................39Input Devices ................................................................................................39Keyboard Shortcuts..............................................................................40Keyboard Layout..................................................................................40Mouse...................................................................................................41Detecting and Configuring a Modem ..........................................................42Configuring a Serial-Port Modem .......................................................42Configuring WinModems for Laptops................................................42Configuring Power Management in Ubuntu ...............................................43Setting the Date and Time............................................................................44Using the date Command ...................................................................45Using the hwclock Command ............................................................45Changing the Time and Date..............................................................46Configuring and Using CD, DVD, and CD-RW Drives................................46Checking Drive Assignment................................................................47Configuring Wireless Networks ....................................................................48Reference .......................................................................................................493 Working with Gnome 51The Gnome Desktop Environment ..............................................................52Gnome: The GNU Network Object Model Environment...................52Eye Candy for the Masses.............................................................................54Basic X Concepts...........................................................................................55Using X..........................................................................................................56Elements of the xorg.conf File ............................................................57Configuring X......................................................................................62Starting X ......................................................................................................64Using a Display Manager.....................................................................65Changing Window Managers..............................................................73KDE–The Other Environment.....................................................................77XFce...............................................................................................................78Reference .......................................................................................................784 Command Line Quickstart 79What Is the Command Line? .......................................................................79Navigating Through the File System...................................................83Managing Files with the Shell.............................................................85Working with Compressed Files..........................................................86Use Essential Commands from the /bin and /sbin Directories ..........87Use and Edit Files in the /etc Directory ..............................................87Protect the Contents of User Directories–/home ..............................87Use the Contents of the /proc Directory to Interactwith the Kernel..................................................................................87Work with Shared Data in the /usr Directory.....................................89Temporary File Storage in the /tmp Directory....................................89Access Variable Data Files in the /var Directory .................................89Logging In to and Working with Linux .......................................................90Text-based Console Login....................................................................90Logging Out.........................................................................................90Logging In and Out from a Remote Computer ..................................91Using Environment Variables..............................................................92Using the Text Editors ..................................................................................95Working with vi...................................................................................96Working with emacs............................................................................97Working with Permissions............................................................................99Assigning Permissions .......................................................................100Directory Permissions........................................................................101Understanding Set User ID and Set Group ID Permissions..............103Working as Root..........................................................................................104Creating Users....................................................................................105Deleting Users....................................................................................106Shutting Down the System ...............................................................106Rebooting the System........................................................................107Reading Documentation.............................................................................108Using Man Pages................................................................................108Reference .....................................................................................................110Part II Desktop Ubuntu5 On the Internet 113Getting Started with Firefox .......................................................................114Choosing an Email Client ..........................................................................115Evolution ...........................................................................................116Mozilla Thunderbird..........................................................................118KMail..................................................................................................120Other Mail Clients.............................................................................120RSS Readers..................................................................................................120Firefox ................................................................................................122Liferea.................................................................................................122Instant Messaging with Pidgin ...................................................................123Internet Relay Chat.....................................................................................124Usenet Network Newsgroups......................................................................127The Pan News Client Newsreader...............................................................128Videoconferencing with Ekiga....................................................................130Reference .....................................................................................................1326 Productivity Applications 133Introducing OpenOffice.org .......................................................................134Configuring OpenOffice.org .............................................................136Working with OpenOffice.org Writer ...............................................137Working with OpenOffice.org Calc...................................................140Office Suites for Ubuntu .............................................................................144Working with Gnome Office.............................................................146Working with KOffice........................................................................149Productivity Applications Written for Microsoft Windows.......................150Reference .....................................................................................................1527 Multimedia Applications 153Sound and Music ........................................................................................153Sound Cards.......................................................................................154Adjusting Volume..............................................................................155Sound Formats...................................................................................156Listening to Music .............................................................................157Graphics Manipulation...............................................................................163The GNU Image Manipulation Program...........................................163Using Scanners in Ubuntu ................................................................164Working with Graphics Formats .......................................................166Capturing Screen Images...................................................................168Using Digital Cameras with Ubuntu ..........................................................168Handheld Digital Cameras ................................................................168Using F-Spot.......................................................................................169Burning CDs and DVDs in Ubuntu............................................................170Creating CDs and DVDs with Ubuntu’s Graphical Clients..............172Creating CDs from the Command Line ...........................................174Creating DVDs from the Command Line.........................................176Viewing Video.............................................................................................178TV and Video Hardware ....................................................................178Video Formats....................................................................................180Viewing Video in Linux.....................................................................181Personal Video Recorders ..................................................................181DVD and Video Players .....................................................................182Reference .....................................................................................................1828 Printing with Ubuntu 185Overview of Ubuntu Printing.....................................................................185Configuring and Managing Print Services .................................................187GUI-Based Printer Configuration Quickstart ....................................187Managing Printing Services ...............................................................188Creating and Configuring Local Printers ...................................................189Creating the Print Queue ..................................................................190Editing Printer Settings......................................................................192Reference .....................................................................................................1959 Games 197Linux Gaming.............................................................................................197Installing Proprietary Video Drivers..................................................198Installing Games in Ubuntu .......................................................................199DOOM 3 ............................................................................................200Unreal Tournament 2004 ..................................................................201Quake 4..............................................................................................202Wolfenstein: Enemy Territory ...........................................................203Battle for Wesnoth.............................................................................204Playing Windows Games with Cedega.......................................................204Reference .....................................................................................................205Part III System Administration10 Managing Users 209User Accounts .............................................................................................209The Super User/Root User .................................................................210User IDs and Group IDs ....................................................................212File Permissions .................................................................................212Managing Groups .......................................................................................213Group Management Tools.................................................................214Managing Users...........................................................................................216User Management Tools ....................................................................216Adding New Users .............................................................................218Monitoring User Activity on the System ..........................................219Managing Passwords...................................................................................220System Password Policy .....................................................................220The Password File ..............................................................................220Shadow Passwords .............................................................................221Managing Password Security for Users..............................................223Changing Passwords in a Batch ........................................................224Granting System Administrator Privileges to Regular Users......................224Temporarily Changing User Identity with the su Command ..........225Granting Root Privileges on Occasion–The sudo Command .........227Disk Quotas.................................................................................................229Implementing Quotas .......................................................................230Manually Configuring Quotas ..........................................................230Reference .....................................................................................................23211 Automating Tasks 233Running Services at Bootup........................................................................234Beginning the Boot Loading Process..........................................................234Loading the Linux Kernel..................................................................235System Services and Runlevels ..........................................................236Runlevel Definitions..........................................................................236Booting into the Default Runlevel ....................................................237Booting to a Non-Default Runlevel with GRUB ...............................237Understanding init Scripts and the Final Stage of Initialization......238Controlling Services at Boot with Administrative Tools ..................239Changing Runlevels...........................................................................240Troubleshooting Runlevel Problems .................................................240Starting and Stopping Services Manually...................................................241Scheduling Tasks .........................................................................................242Using at and batch to Schedule Tasks for Later................................242Using cron to Run Jobs Repeatedly...................................................245Basic Shell Control......................................................................................248The Shell Command Line .................................................................248Shell Pattern-Matching Support........................................................250Redirecting Input and Output...........................................................251Piping Data ........................................................................................252Background Processing ......................................................................252Writing and Executing a Shell Script..........................................................253Running the New Shell Program.......................................................254Storing Shell Scripts for Systemwide Access......................................255Interpreting Shell Scripts Through Specific Shells............................256Using Variables in Shell Scripts .........................................................258Assigning a Value to a Variable .........................................................258Accessing Variable Values ..................................................................259Positional Parameters ........................................................................259A Simple Example of a Positional Parameter....................................259Using Positional Parameters to Access and RetrieveVariables from the Command Line ................................................260Using a Simple Script to Automate Tasks..........................................261Built-In Variables ...............................................................................263Special Characters..............................................................................263Use Double Quotes to Resolve Variables in Strings withEmbedded Spaces ............................................................................264Using Single Quotes to Maintain Unexpanded Variables ................265Using the Backslash as an Escape Character.....................................266Using the Backtick to Replace a String with Output ........................266Comparison of Expressions in pdksh and bash................................26700_1091_fm.Comparing Expressions with tcsh.....................................................272The for Statement ..............................................................................276The while Statement..........................................................................277The until Statement...........................................................................279The repeat Statement (tcsh) ..............................................................280The select Statement (pdksh) ............................................................280The shift Statement ...........................................................................281The if Statement ................................................................................281The case Statement ............................................................................283The break and exit Statements..........................................................285Using Functions in Shell Scripts........................................................285Reference .....................................................................................................28712 System-Monitoring Tools 289Console-Based Monitoring .........................................................................289Using the kill Command to Control Processes.................................291Using Priority Scheduling and Control.............................................292Displaying Free and Used Memory with free ...................................294Disk Space ..........................................................................................295Disk Quotas........................................................................................296Graphical Process and System Management Tools ....................................296KDE Process- and System-Monitoring Tools ..............................................298Reference .....................................................................................................29913 Backing Up 301Choosing a Backup Strategy .......................................................................301Why Data Loss Occurs.......................................................................302Assessing Your Backup Needs and Resources ....................................303Evaluating Backup Strategies.............................................................304Making the Choice ............................................................................307Choosing Backup Hardware and Media .....................................................307Removable Storage Media .................................................................308Network Storage.................................................................................309Tape Drive Backup .............................................................................309Using Backup Software ...............................................................................310tar: The Most Basic Backup Tool .......................................................310The GNOME File Roller .....................................................................312Using the Amanda Backup Application............................................315Alternative Backup Software..............................................................316Copying Files...............................................................................................316Copying Files Using tar .....................................................................317Compressing, Encrypting, and Sending tar Streams ........................317Copying Files Using cp......................................................................318Copying Files Using mc.....................................................................318System Rescue .............................................................................................319The Ubuntu Rescue Disc....................................................................320Backing Up and Restoring the Master Boot Record..........................320Booting the System from a Generic Boot Floppy .............................320Using a GRUB Boot Floppy ...............................................................321Using the Recovery Facility ...............................................................322Reference .....................................................................................................32214 Networking 325Laying the Foundation: The localhost Interface........................................326Checking for the Availability of the Loopback Interface .................326Configuring the Loopback Interface Manually ................................326Networking with TCP/IP.............................................................................328TCP/IP Addressing .............................................................................329Using IP Masquerading in Ubuntu ...................................................331Ports ...................................................................................................332Network Organization ................................................................................333Subnetting..........................................................................................333Subnet Masks .....................................................................................334Broadcast, Unicast, and Multicast Addressing ..................................334Hardware Devices for Networking..............................................................335Network Interface Cards....................................................................335Network Cable ...................................................................................337Hubs and Switches.............................................................................338Routers and Bridges ...........................................................................339Initializing New Network Hardware..................................................339Using Network Configuration Tools...........................................................342Command-Line Network Interface Configuration ...........................342Network Configuration Files .............................................................347Using Graphical Configuration Tools ...............................................349Dynamic Host Configuration Protocol ......................................................351How DHCP Works .............................................................................351Activating DHCP at Installation and Boot Time ..............................352DHCP Software Installation and Configuration ...............................353Using DHCP to Configure Network Hosts........................................354Other Uses for DHCP.........................................................................357Wireless Networking ...................................................................................357Support for Wireless Networking in Ubuntu ....................................357Advantages of Wireless Networking..................................................358Choosing from Among Available Wireless Protocols .......................359Beyond the Network and onto the Internet ..............................................360Common Configuration Information........................................................360Configuring Digital Subscriber Line Access................................................362Understanding Point-to-Point Protocol over Ethernet.....................363Configuring a PPPoE Connection Manually.....................................363Configuring Dial-Up Internet Access .........................................................365Configuring a Dial-Up Connection Manually..................................365Troubleshooting Connection Problems .....................................................368Reference .....................................................................................................36915 Remote Access with SSH and Telnet 371Setting Up a Telnet Server...........................................................................371Telnet Versus SSH........................................................................................372Setting Up an SSH Server ............................................................................372The SSH Tools..............................................................................................373Using scp to Copy Individual Files Between Machines....................374Using sftp to Copy Many Files Between Machines ..........................374Using ssh-keygen to Enable Key-based Logins..................................375Remote X.....................................................................................................377XDMCP..............................................................................................377VNC....................................................................................................378Reference .....................................................................................................378Part IV Ubuntu as a Server16 File and Print 381Using the Network File System...................................................................382Installing and Starting or Stopping NFS ...........................................382NFS Server Configuration..................................................................383NFS Client Configuration..................................................................384Putting Samba to Work...............................................................................385Manually Configuring Samba with /etc/samba/smb.conf................387Testing Samba with the testparm Command ...................................390Starting the smbd Daemon ...............................................................390Mounting Samba Shares....................................................................391Configuring Samba Using SWAT.......................................................392Network and Remote Printing with Ubuntu..............................................397Creating Network Printers ..........................................................................397Enabling Network Printing on a LAN ...............................................397Session Message Block Printing.........................................................398Using the Common UNIX Printing System GUI .......................................399Creating a CUPS Printer Entry ..........................................................400Avoiding Printer Support Problems............................................................403All-in-One (Print/Fax/Scan) Devices .................................................403Using USB and Legacy Printers .........................................................403Reference .....................................................................................................40517 Apache Web Server Management 407About the Apache Web Server ....................................................................407Installing the Apache Server.......................................................................409Installing with APT............................................................................409Building the Source Yourself .............................................................410Starting and Stopping Apache ....................................................................413Starting the Apache Server Manually................................................413Using /etc/init.d/apache2..................................................................414Runtime Server Configuration Settings......................................................416Runtime Configuration Directives ....................................................416Editing apache2.conf.........................................................................417Apache Multiprocessing Modules .....................................................419Using .htaccess Configuration Files ..................................................420File System Authentication and Access Control ........................................422Restricting Access with allow and deny............................................422Authentication...................................................................................423Final Words on Access Control .........................................................425Apache Modules..........................................................................................426mod_access ........................................................................................427mod_alias ...........................................................................................427mod_asis ............................................................................................427mod_auth...........................................................................................428mod_auth_anon.................................................................................428mod_auth_dbm .................................................................................428mod_auth_digest ...............................................................................428mod_autoindex..................................................................................429mod_cgi..............................................................................................429mod_dir and mod_env ......................................................................429mod_expires.......................................................................................429mod_headers......................................................................................429mod_include ......................................................................................429mod_info and mod_log_config .........................................................430mod_mime and mod_mime_magic ..................................................430mod_negotiation ...............................................................................430mod_proxy.........................................................................................430mod_rewrite.......................................................................................430mod_setenvif .....................................................................................430mod_speling.......................................................................................431mod_status.........................................................................................431mod_ssl ..............................................................................................431mod_unique_id..................................................................................431mod_userdir .......................................................................................431mod_usertrack....................................................................................431mod_vhost_alias ................................................................................431Virtual Hosting............................................................................................432Address-Based Virtual Hosts ..............................................................432Name-Based Virtual Hosts .................................................................432Logging........................................................................................................434Other Web Servers for Use with Ubuntu....................................................435Sun ONE Web Server .........................................................................436Zope ...................................................................................................436Zeus Web Server.................................................................................436Reference .....................................................................................................43718 Remote File Serving with FTP 439Choosing an FTP Server..............................................................................439Choosing an Authenticated or Anonymous Server ..........................440Ubuntu FTP Server Packages .............................................................440Other FTP Servers ..............................................................................440Installing FTP Software ...............................................................................441The FTP User ...............................................................................................442inetd Configuration for wu-ftpd ................................................................444Starting the Very Secure FTP Server (vsftpd) Package.......................445Configuring the Very Secure FTP Server.....................................................445Controlling Anonymous Access........................................................445Other vsftpd Server Configuration Files ...........................................446Configuring the Server ...............................................................................448Using Commands in the ftpaccess File to Configure wu-ftpd...................448Configure Access Control..................................................................449Configure User Information..............................................................452Configure System Logging ................................................................456Configure Permission Control ..........................................................457Configure Commands Directed Toward the cdpath.........................459Structure of the shutdown File..........................................................460Configuring FTP Server File-Conversion Actions.......................................460Strip Prefix .........................................................................................461Strip Postfix........................................................................................461Add-On Prefix ....................................................................................461Add-On Postfix ..................................................................................461External Command ...........................................................................461An Example of Conversions in Action..............................................462Using the ftphosts File to Allow or Deny FTP Server Connection ............463Using Commands for Server Administration.............................................464Display Information About Connected Users...................................464Count the Number of Connections..................................................465Use /usr/sbin/ftpshut to Schedule FTP Server Downtime ................466Use /var/log/xferlog to View a Log of Server Transactions...............467Reference .....................................................................................................47019 Handling Electronic Mail 471How Email Is Sent and Received ................................................................471The Mail Transport Agent..................................................................472Choosing an MTA..............................................................................474The Mail Delivery Agent ...................................................................474The Mail User Agent..........................................................................475Basic Postfix Configuration and Operation ...............................................476Configuring Masquerading ...............................................................477Using Smart Hosts .............................................................................477Setting Message Delivery Intervals....................................................477Mail Relaying .....................................................................................478Forwarding Email with Aliases ..........................................................478Using Fetchmail to Retrieve Mail ...............................................................479Installing Fetchmail...........................................................................479Configuring Fetchmail ......................................................................480Choosing a Mail Delivery Agent ................................................................483Procmail .............................................................................................483Spamassassin......................................................................................484Squirrelmail........................................................................................484Virus Scanners....................................................................................484Mail Daemons.............................................................................................485Alternatives to Microsoft Exchange Server.................................................485Microsoft Exchange Server/Outlook Client ......................................486CommuniGate Pro.............................................................................486Oracle Collaboration Suite ................................................................486Bynari.................................................................................................486Open-Xchange...................................................................................486phpgroupware....................................................................................487PHProjekt ...........................................................................................487Horde .................................................................................................487Reference .....................................................................................................48820 Proxying and Reverse Proxying 489What Is a Proxy Server? ..............................................................................489Installing Squid ...........................................................................................490Configuring Clients ....................................................................................490Access Control Lists ....................................................................................491Specifying Client IP Addresses....................................................................495Example Configurations .............................................................................496Reference .....................................................................................................49821 Administering Database Services 499A Brief Review of Database Basics ..............................................................500How Relational Databases Work .......................................................501Understanding SQL Basics.................................................................503Creating Tables ..................................................................................503Inserting Data into Tables .................................................................504Retrieving Data from a Database.......................................................505Choosing a Database: MySQL Versus PostgreSQL......................................507Speed..................................................................................................507Data Locking......................................................................................508ACID Compliance in Transaction Processingto Protect Data Integrity .................................................................509SQL Subqueries ..................................................................................509Procedural Languages and Triggers ...................................................510Configuring MySQL....................................................................................510Setting a Password for the MySQL Root User ...................................511Creating a Database in MySQL .........................................................511Granting and Revoking Privileges in MySQL ...................................512Configuring PostgreSQL .............................................................................513Initializing the Data Directory in PostgreSQL ..................................514Creating a Database in PostgreSQL ...................................................515Creating Database Users in PostgreSQL ............................................516Deleting Database Users in PostgreSQL ............................................517Granting and Revoking Privileges in PostgreSQL .............................517Database Clients..........................................................................................518SSH Access to a Database...................................................................518Local GUI Client Access to a Database .............................................520Web Access to a Database..................................................................520The MySQL Command-Line Client ..................................................521The PostgreSQL Command-Line Client............................................523Graphical Clients...............................................................................523Reference .....................................................................................................52422 LDAP 525Configuring the Server ...............................................................................526Populating Your Directory.................................................................528Configuring Clients ....................................................................................530Evolution ...........................................................................................531Thunderbird.......................................................................................532Administration............................................................................................532Reference .....................................................................................................533Part V Programming Linux23 Using Perl 537Using Perl with Linux.................................................................................537Perl Versions ......................................................................................538A Simple Perl Program.......................................................................538Perl Variables and Data Structures..............................................................540Perl Variable Types.............................................................................540Special Variables.................................................................................541Operators.....................................................................................................542Comparison Operators ......................................................................542Compound Operators........................................................................543Arithmetic Operators.........................................................................544Other Operators.................................................................................544Special String Constants ....................................................................545Conditional Statements: if/else and unless................................................545if .........................................................................................................546unless .................................................................................................546Looping .......................................................................................................547for.......................................................................................................547foreach ...............................................................................................547while ..................................................................................................548until ...................................................................................................548last and next ......................................................................................548do ... while and do ... until ...............................................................549Regular Expressions.....................................................................................549Access to the Shell ......................................................................................550Modules and CPAN.....................................................................................551Code Examples............................................................................................552Sending Mail......................................................................................552Purging Logs ......................................................................................554Posting to Usenet...............................................................................555One-Liners .........................................................................................556Command-Line Processing................................................................556Reference .....................................................................................................55724 Working with Python 561Python on Linux.........................................................................................561Getting Interactive.............................................................................562The Basics of Python...................................................................................563Numbers.............................................................................................563More on Strings .................................................................................564Lists ....................................................................................................567Dictionaries........................................................................................569Conditionals and Looping ................................................................570Functions.....................................................................................................572Object Orientation......................................................................................573Class and Object Variables ................................................................574Constructors and Destructors............................................................575Class Inheritance ...............................................................................575The Standard Library and the Vaults of Parnassus ....................................577Reference .....................................................................................................57725 Writing PHP Scripts 579Introduction to PHP ...................................................................................580Entering and Exiting PHP Mode .......................................................580Variables.............................................................................................580Arrays .................................................................................................582Constants...........................................................................................584References ..........................................................................................584Comments .........................................................................................585Escape Sequences ...............................................................................585Variable Substitution .........................................................................587Operators ...........................................................................................587Conditional Statements.....................................................................589Special Operators ...............................................................................591Switching ...........................................................................................592Loops..................................................................................................593Including Other Files.........................................................................596Basic Functions ...........................................................................................596Strings ................................................................................................596Arrays .................................................................................................600Files ....................................................................................................602Miscellaneous.....................................................................................604Handling HTML Forms ...............................................................................607Databases.....................................................................................................608Introduction to PEAR::DB .................................................................608Reference .....................................................................................................61026 C/C++ Programming Tools for Ubuntu 613Programming in C with Linux ...................................................................613Using the C Programming Project Management ToolsProvided with Ubuntu..............................................................................614Building Programs with make ...........................................................615Using Makefiles..................................................................................615Using the autoconf Utility to Configure Code .................................617Managing Software Projects with Subversion...................................617Debugging Tools ................................................................................618Using the GNU C Compiler .......................................................................619Graphical Development Tools ....................................................................620Using the KDevelop Client................................................................620The Glade Client for Developing in GNOME...................................621Reference .....................................................................................................62327 Mono 625Why Use Mono? .........................................................................................625Mono on the Command Line ....................................................................626The Structure of a C# Program..........................................................628Printing Out the Parameters..............................................................629Creating Your Own Variables ............................................................629Adding Some Error Checking............................................................630Building on Mono’s Libraries .....................................................................631Searching with Beagle........................................................................631Creating a GUI with Gtk# .................................................................634Reference .....................................................................................................636Part VI Ubuntu Housekeeping28 Securing Your Machines 639Understanding Computer Attacks..............................................................639Assessing Your Vulnerability.......................................................................641Protecting Your Machine ............................................................................642Securing a Wireless Network .............................................................642Passwords and Physical Security .......................................................643Configuring and Using Tripwire .......................................................644Devices ...............................................................................................645Viruses .........................................................................................................645Configuring Your Firewall...........................................................................646Forming a Disaster Recovery Plan ..............................................................647Keeping Up-to-Date on Linux Security Issues............................................648Reference .....................................................................................................64929 Performance Tuning 651Hard Disk ....................................................................................................651Using the BIOS and Kernel to Tune the Disk Drives ........................652The hdparm Command.....................................................................653File System Tuning ............................................................................654The tune2fs Command......................................................................654The e2fsck Command........................................................................655The badblocks Command .................................................................655Disabling File Access Time.................................................................655Kernel ..........................................................................................................655Apache.........................................................................................................656MySQL.........................................................................................................658Measuring Key Buffer Usage..............................................................658Using the Query Cache .....................................................................660Miscellaneous Tweaks........................................................................661Query Optimization ..........................................................................661Reference .....................................................................................................66230 Command Line Masterclass 663Why Use the Shell?.....................................................................................664Basic Commands.........................................................................................665Printing the Contents of a File with cat ...........................................666Changing Directories with cd ...........................................................667Changing File Access Permissions with chmod................................668Copying Files with cp........................................................................669Printing Disk Usage with du .............................................................669Finding Files by Searching with find ................................................670Searches for a String in Input with grep ...........................................673Paging Through Output with less .....................................................674Creating Links Between Files with ln................................................676Finding Files from an Index with locate...........................................677Listing Files in the Current Directory with ls ...................................678Reading Manual Pages with man......................................................679Making Directories with mkdir .........................................................680Moving Files with mv........................................................................680Listing Processes with ps ...................................................................680Deleting Files and Directories with rm .............................................681Printing the Last Lines of a File with tail..........................................682Printing Resource Usage with top .....................................................682Printing the Location of a Command with which...........................684Combining Commands ..............................................................................684Multiple Terminals......................................................................................686Reference .....................................................................................................68731 Managing Software 689Using Add/Remove Applications for Software Management.....................689Using Synaptic for Software Management .................................................691Staying Up-to-Date......................................................................................693Working on the Command Line ................................................................694Day-to-Day Usage ..............................................................................694Finding Software................................................................................697Compiling Software from Source ...............................................................698Reference .....................................................................................................69932 Kernel and Module Management 701The Linux Kernel ........................................................................................702The Linux Source Tree .......................................................................702Types of Kernels.................................................................................704Managing Modules ..........