Ubuntu Linux Toolbox.1000Plus .Wiley

Ubuntu Linux Toolbox.1000Plus .Wiley

Now pay Easier and Secure using Paypal

Read more


1000+ Commands for Ubuntu

and Debian Power Users

Christopher Negus
François Caen

e-books shop
Ubuntu Linux Toolbox.1000Plus Command

About the Authors
Christopher Negus is the author of the best-selling Fedora and Red Hat Linux Bibles,
Linux Toys, Linux Troubleshooting Bible, and Linux Bible 2007 Edition. He is a member of
the Madison Linux Users Group. Prior to becoming a full-time writer, Chris served
for eight years on development teams for the Unix operating system at AT&T, where
Unix was created and developed. He also worked with Novell on Unix development and Caldera Linux.

François Caen, through his company Turbosphere LLC, hosts and manages business
application infrastructures, with 95 percent running on Linux systems. As an open
source advocate, he has lectured on OSS network management and Internet services,
and served as president of the Tacoma Linux User Group. François is a Red Hat
Certified Engineer (RHCE). In his spare time, François enjoys managing enterprise Cisco networks.

I would like to acknowledge Canonical Ltd. and the Ubuntu community for their
ongoing excellent work producing the Linux-based Ubuntu operating system.
Special thanks to François Caen for giving up most of his free time over the past year,
while juggling his existing professional obligations, to co-author the book with me.
Thomas Blader went far beyond his technical editor title, providing excellent insights
and meticulous testing throughout the book. Eric Foster-Johnson came in near the end
of the process and provided Ubuntu feature enhancements throughout the book.
At Wiley, I’d like to thank Jenny Watson for sticking with us through the development
of the book. And, last but not least, thanks to Sara Shlaer for keeping us on track with
schedules and supplying the never-ending ToDo lists we needed to accomplish to get this book published.
— Christopher Negus

I would like to thank Chris Negus for giving me the opportunity to co-author this book
with him. We had wanted to write together for the last couple of years, and this Toolbox
series was the perfect fit for our collaboration.

I couldn’t have worked on this book without the unrelenting support from my wife,
Tonya. Thank you for emptying the dishwasher all these times even though we both
know it’s my job.

Thanks to Thomas Blader for his detailed tech editing. Thanks to Eric Foster-Johnson
for adding his Ubuntu expertise to this book. Thanks to Sara Shlaer for her guidance
throughout the authoring process, and to Jenny Watson for being the most patient catherder
out there. Special thanks to Wayne Tucker for sharing his Debian experience
with me over the years, especially when it came to cutting-edge features like kernel 2.4.
Finally, I would like to express my gratitude to Mark Shuttleworth, Canonical Ltd.,
and the Ubuntu community for making Ubuntu possible and helping spread Linux to the masses.
— François Caen


The huge, enthusiastic Ubuntu community has swept up thousands and thousands of
new Ubuntu Linux users. If you are one of them, you will probably soon find yourself
wanting to dig beneath the surface of Ubuntu’s applications and graphical tools. You’ll
want to become a power user.

Becoming a power user with any Linux system means being able to work from the
command line. Few graphical interfaces will provide you with the options and flexibility
you get with commands that address the same features.

Ubuntu Linux Toolbox provides you with more than 1000 specific command lines to
help you dig deeply into Linux. Whether you are a systems administrator or desktop
user, the book will show you commands to create file systems, troubleshoot networks,
lock down security, and dig out almost anything you care to know about your Linux system.

This book’s focus for your Linux command-line journey is Ubuntu, the communitybased
Linux distribution sponsored by Canonical Ltd., and the Debian GNU/Linux
system on which it is based. Tapping into the skills needed to run those systems
can help you to work with your own Linux systems and to learn what you need as a Linux professional.

Ubuntu Takes Linux by Storm
Since its inaugural release in 2004, Ubuntu (www.ubuntu.com) has become the most
popular and, arguably, best loved of the Linux distributions. From its name, which
translates to humanity toward others, to its focus on support for many languages and
special needs, Ubuntu has reflected its ideals of spreading free software beyond the
standard Linux target markets of geeks and corporate servers.

The Ubuntu project does everything it can to help ease new users into using its Linuxbased
Ubuntu operating system. Ubuntu live CDs let a new user try out Ubuntu before
installing it. If the user likes Ubuntu, a single click can start an Ubuntu install to hard
disk. And because Ubuntu is based on Debian GNU/Linux, Ubuntu has been able to
make massive amounts of software from the Debian software repositories available
free to Ubuntu users.

Although it’s true that Ubuntu focuses on ease-of-use desktop systems, that doesn’t
mean Ubuntu has no commercial Linux value. In fact, Canonical offers paid enterprisequality
support for its systems through its Canonical Global Support Services team
(www.ubuntu.com/support/paid). Canonical also offers training courses to help you
become an Ubuntu Training Partner (www.ubuntu.com/support/training). In other
words, there are professional opportunities for those who learn to operate Ubuntu.

Who Should Read This Book
This book is for anyone who wants to access the power of a Linux system as a systems
administrator or user. You may be a Linux enthusiast, a Linux professional, or possibly
a computer professional who is increasingly finding the Windows systems in your data
center supplanted by Linux boxes.

The bottom line is that you want to find quick and efficient ways of getting Ubuntu
and other Debian-based systems working at peak performance. Those systems may
be a few desktop systems at work, a file and print server at your school, or a home
web server that you’re doing just for fun.

In the best case, you should already have some experience with Linux. However, if you
are a computer professional with skills managing other types of operating systems,
such as Windows, you should be able to easily adapt your knowledge to be able to use
the specific commands we cover in the book.

How This Book Is Structured
This book is neither a pure reference book (with alphabetically listed components)
nor a guide (with step-by-step procedures for doing tasks). Instead, the book is
organized by topics and aimed at including as many useful commands and options
as we could fit.

Chapter 1 starts by giving you a basic understanding of what Ubuntu is and how it
relates to other Linux systems, such as various Debian-based distributions. Then it
describes some of the vast resources available to support your experience with this
book (such as man pages, info material, and help text). Chapter 2 provides a quick
overview of installation and then describes useful commands such as apt-get for
getting and managing your Ubuntu software.

Commands that a regular user may find useful in Linux are described in Chapters 3,
4, 5, and 6. Chapter 3 describes tools for using the shell, Chapter 4 covers commands
for working with files, and Chapter 5 describes how to manipulate text. Chapter 6 tells
how to work with music and image files.

Starting with Chapter 7, we get into topics relating to system administration. Creating
and checking file systems are covered in Chapter 7, while commands for doing data
backups are described in Chapter 8. Chapter 9 describes how to manipulate running
processes, and Chapter 10 describes administrative tools for managing basic components,
such as hardware modules, CPU use, and memory use.

Chapter 11 begins the chapters devoted to managing network resources by describing
how to set up and work with wired, wireless, and dial-up network interfaces.
Chapter 12 covers text-based commands for web browsing, file transfer, file sharing,
chats, and email. Tools for doing remote system administration are included in Chapter 13.

The last chapter (Chapter 14) tells you how to lock down security using features such
as firewalls and logging. After that there are three appendixes that provide reference
information for text editing, shell features (metacharacters and variables), and system
settings (from the /proc file system).

What You Need to Use This Book
Although we hope you enjoy the beauty of our prose, this is not meant to be a book
you curl up with in front of a nice fire with a glass of wine. We expect you will be sitting
in front of a computer screen trying to connect to a network, fix a file system, or
add a user. The wine is optional.

In other words, the book is meant to be a companion as you work on an Ubuntu or
Debian operating system. If you don’t already have an Ubuntu or Debian system
installed, refer to Chapter 2 for information on getting and installing those systems.
All of the commands in this book have been tested against Ubuntu on x86 or x86_64
architecture. However, because many of these commands have been around for a long
time (some dating back over 30 years to the original Unix days), most will work exactly
as described here on Debian systems, regardless of CPU architecture.

Many of the commands described in this book will work on other Linux and Unix
systems as well. Because this book focuses on Ubuntu, descriptions will differ from
other Linux systems most prominently in the areas of packaging, installation, and
GUI administration tools.


e-books shop

Purchase Now !
Just with Paypal

Product details
 File Size
 3,296 KB
 363 p
 File Type
 PDF format
 2008 by Wiley Publishing, Inc  

Contents at a Glance
Chapter 1: Starting with Ubuntu Linux . . . . . . . . . . . . . . . . .1
Chapter 2: Installing Ubuntu and Adding Software . . . . . . . .17
Chapter 3: Using the Shell . . . . . . . . . . . . . . . . . . . . . . . . . .49
Chapter 4: Working with Files . . . . . . . . . . . . . . . . . . . . . . .69
Chapter 5: Manipulating Text . . . . . . . . . . . . . . . . . . . .  . . .89
Chapter 6: Playing with Multimedia . . . . . . . . . . . . . . . . . . .109
Chapter 7: Administering File Systems . . . . . . . . . . . . . . .. .123
Chapter 8: Backups and Removable Media . . . . . . . . . . . . .151
Chapter 9: Checking and Managing Running Processes . . . .169
Chapter 10: Managing the System . . . . . . . . . . . . . . . . . .. .187
Chapter 11: Managing Network Connections . . . . . . . . . .. .211
Chapter 12: Accessing Network Resources . . . . . . . . . .. . .235
Chapter 13: Doing Remote System Administration . . . . . .. .255
Chapter 14: Locking Down Security . . . . . . . . . . . . . . . . . .273
Appendix A: Using vi or Vim Editors . . . . . . . . . . . . . . . . . .289
Appendix B: Shell Special Characters and Variables . . . . .. .297
Appendix C: Getting Information from /proc . . . . . . . . .. . . .301
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307

Table of Contents
Acknowledgments xix
Introduction xxi
Chapter 1: Starting with Ubuntu Linux
Ubuntu, Debian, and Linux 2
Ubuntu Compared to Other Linux Distributions 3
Finding Ubuntu Resources 4
Ubuntu Software 6
Focusing on Linux Commands 7
Finding Commands 8
Reference Information in Ubuntu 11
Using help Messages 11
Using man Pages 12
Using info Documents 14
Summary 15
Chapter 2: Installing Ubuntu and Adding Software
Obtaining and Installing Ubuntu 17
Preparing to Install 19
Choosing Installation Options 19
Answering Installation Questions 20
Working with Debian Software Packages 21
Working with Software Packages 23
Enabling More Repositories for apt 24
Managing Software with APT 25
Adding an APT Repository and Third-Party Signature Key 27
Finding Packages with APT 28
Installing Packages with APT 28
Upgrading Packages with APT 29
Upgrading a Single Package with APT 29
Removing Packages with APT 30
Cleaning Up Packages with APT 30
Managing Software with dpkg 31
Installing a Package with dpkg 32
Removing a Package with dpkg 33
Extracting Files from a .deb File with dpkg 33
Querying Information about .deb Packages 33
Managing Software with aptitude 36
Updating and Upgrading Packages with aptitude 37
Querying Information about Packages with aptitude 38
Installing Packages with aptitude 38
Removing Packages with aptitude 39
Cleaning Up Packages with aptitude 39
Useful Combinations of Options with aptitude 40
Verifying Installed Packages with debsums 41
Building deb Packages 45
Summary 48
Chapter 3: Using the Shell
Terminal Windows and Shell Access 49
Using Terminal Windows 49
Using Virtual Terminals 51
Using the Shell 52
Using Bash History 52
Using Command Line Completion 54
Redirecting stdin and stdout 54
Using alias 57
Watching Commands 58
Watching Files 58
Acquiring Super User Power 59
Using the su Command 59
Delegating Power with sudo 60
Using Environment Variables 62
Creating Simple Shell Scripts 63
Editing and Running a Script 63
Adding Content to Your Script 64
Summary 68
Chapter 4: Working with Files
Understanding File Types 69
Using Regular Files 69
Using Directories 70
Using Symbolic and Hard Links 71
Using Device Files 72
Using Named Pipes and Sockets 73
Setting File/Directory Permissions 73
Changing Permissions with chmod 74
Setting the umask 76
Changing Ownership 76
Traversing the File System 77
Copying Files 78
Changing File Attributes 80
Searching for Files 81
Finding Files with locate 82
Locating Files with find 82
Using Other Commands to Find Files 85
Finding Out More About Files 85
Listing Files 85
Verifying Files 86
Summary 87
Chapter 5: Manipulating Text
Matching Text with Regular Expressions 89
Editing Text Files 90
Using the JOE Editor 91
Using the Pico and nano Editors 94
Graphical Text Editors 96
Listing, Sorting, and Changing Text 96
Listing Text Files 97
Paging Through Text 98
Paginating Text Files with pr 98
Searching for Text with grep 99
Replacing Text with sed 102
Translating or Removing Characters with tr 103
Checking Differences Between Two Files with diff 104
Using awk and cut to Process Columns 105
Converting Text Files to Different Formats 106
Summary 107
Chapter 6: Playing with Multimedia
Working with Audio 109
Playing Music 109
Adjusting Audio Levels 111
Ripping CD Music 112
Encoding Music 113
Streaming Music 115
Converting Audio Files 117
Transforming Images 118
Getting Information about Images 118
Converting Images 119
Converting Images in Batches 120
Summary 122
Chapter 7: Administering File Systems
Understanding File System Basics 123
Creating and Managing File Systems 125
Partitioning Hard Disks 125
Working with File System Labels 129
Formatting a File System 130
Viewing and Changing File System Attributes 131
Creating and Using Swap Partitions 133
Mounting and Unmounting File Systems 134
Mounting File Systems from the fstab File 134
Mounting File Systems with the mount Command 136
Unmounting File Systems with umount 139
Checking File Systems 140
Checking RAID Disks 141
Finding Out About File System Use 143
Logical Volume Manager (LVM) 145
Creating LVM Volumes 145
Using LVM Volumes 148
Growing the LVM Volume 148
Shrinking an LVM Volume 149
Removing LVM Logical Volumes and Groups 150
Summary 150
Chapter 8: Backups and Removable Media
Backing Up Data to Compressed Archives 151
Creating Backup Archives with tar 151
Using Compression Tools 153
Listing, Joining, and Adding Files to tar Archives 156
Deleting Files from tar Archives 157
Backing Up Over Networks 157
Backing Up tar Archives Over ssh 158
Backing Up Files with rsync 159
Backing Up with unison 160
Backing Up to Removable Media 161
Creating Backup Images with mkisofs 162
Burning Backup Images with cdrecord 165
Making and Burning DVDs with growisofs 166
Summary 167
Chapter 9: Checking and Managing Running Processes
Listing Active Processes 170
Viewing Active Processes with ps 170
Watching Active Processes with top 175
Finding and Controlling Processes 177
Using pgrep to Find Processes 177
Using fuser to Find Processes 178
Changing Running Processes 179
Summary 185
Chapter 10: Managing the System
Monitoring Resources 187
Monitoring Memory Use 188
Monitoring CPU Usage 191
Monitoring Storage Devices 194
Mastering Time 196
Changing Time/Date with Graphical Tools 197
Displaying and Setting Your System Clock 197
Displaying and Setting Your Hardware Clock 199
Using Network Time Protocol to Set Date/Time 199
Managing the Boot Process 200
Using the GRUB Boot Loader 201
Repairing the initial ramdisk (initrd) 202
Controlling Startup and Run Levels 203
Straight to the Kernel 205
Poking at the Hardware 207
Summary 209
Chapter 11: Managing Network Connections
Configuring Networks from the GUI 211
Managing Network Interface Cards 212
Managing Network Connections 216
Starting and Stopping Ethernet Connections 216
Viewing Ethernet Connection Information 218
Using Wireless Connections 220
Using Dial-up Modems 222
Checking Name Resolution 225
Troubleshooting Network Problems 227
Checking Connectivity to a Host 227
Checking Address Resolution Protocol (ARP) 228
Tracing Routes to Hosts 229
Displaying netstat Connections and Statistics 231
Other Useful Network Tools 232
Summary 233
Chapter 12: Accessing Network Resources
Running Commands to Browse the Web 235
Transferring Files 237
Downloading Files with wget 237
Transferring Files with cURL 238
Transfering files with FTP Commands 239
Using SSH Tools to Transfer Files 241
Using Windows File Transfer Tools 242
Sharing Remote Directories 243
Sharing Remote Directories with NFS 243
Sharing Remote Directories with Samba 245
Sharing Remote Directories with SSHFS 248
Chatting with Friends in IRC 249
Using Text-Based E-mail Clients 250
Managing E-mail with mail 251
Managing E-mail with mutt 252
Summary 253
Chapter 13: Doing Remote System Administration
Doing Remote Login and Tunneling with SSH 255
Configuring SSH 256
Logging in Remotely with ssh 257
Using screen: A Rich Remote Shell 263
Using a Remote Windows Desktop 265
Connecting to a Windows Desktop with tsclient 266
Connecting to a Windows Desktop with rdesktop 267
Using Remote Linux Desktop and Applications 267
Sharing Desktops Using VNC 268
Setting Up the VNC Server 269
Starting Up the VNC Client 269
Using VNC on Untrusted Networks with SSH 270
Sharing a VNC Desktop with Vino 270
Summary 271
Chapter 14: Locking Down Security
Working with Users and Groups 273
Managing Users the GUI Way 274
Adding User Accounts 274
Modifying User Accounts 276
Deleting User Accounts 277
Managing Passwords 277
Adding Groups 279
Checking on Users 280
Configuring the Built-In Firewall 282
Working with System Logs 286
Using Advanced Security Features 286
Summary 287
Appendix A: Using vi or Vim Editors 289
Starting and Quitting the vi Editor 289
Moving Around in vi 291
Changing and Deleting Text in vi 292
Using Miscellaneous Commands 293
Modifying Commands with Numbers 294
Using Ex Commands 295
Working in Visual Mode 296
Appendix B: Shell Special Characters and Variables 297
Using Special Shell Characters 297
Using Shell Variables 298
Appendix C: Getting Information from /proc 301
Viewing /proc information 301
Changing /proc information 305
Index 307


═════ ═════