Brief Contents


PART I

1 Linux: A Product of the Internet
2 Getting Started
3 An Introduction to the Utilities
4 The Linux Filesystem
5 The Shell
6 Graphical User Interfaces (GUIs)
7 Networking and the Internet
8 The vi Editor
9 The emacs Editor
10 The Bourne Again Shell
11 Shell Programming
12 The TC Shell
13 The Z Shell and Advanced Shell Programming
14 Programming Tools
15 System Administration

PART II

The Utilities
A Regular Expressions
B Help!
C Emulators
D The POSIX Standards
Glossary
Index

Contents


Foreword by Linus Torvalds

Preface

Audience

Benefits to You, the Reader
Scope of Coverage and Features
Supplements
Thanks

PART I
CHAPTER 1

Linux: A Product of the Internet

The Heritage of Linux: UNIX
What's So Good About Linux?

The Code Is Free
Why Is UNIX/Linux Popular with Manufacturers?
The Acceptance of Linux
The Future of Linux
How Can Linux Run on So Many Machines?

The C Programming Language

Overview of Linux

Linux Has a Kernel Programming Interface
Linux Can Support ManyUsers at One Time
Linux Can Support ManyTasks at One Time
Linux Provides a Hierarchical Filesystem With Built-in Security
The Shell Is a Command Interpreter and
Programming Language

Filename Generation
Device-Independent Input and Output
Shell Functions
Job Control

A Large Collection of Useful Utilities
Interprocess Communication
System Administration

Additional Features of Linux

Graphical User Interfaces
(Inter)networking Utilities
Software Development
Screen-Oriented Editors
Advanced Electronic Mail
Running Software From OtherOperating Systems

Summary
Review Exercises

CHAPTER 2

Getting Started

Before You Start

The Superuser

Conventions
Using Linux

Logging In

The Uppercase LOGIN: Prompt
Incorrect Login
After You Log In You are Working with the Shell

Changing Your Password
Logging Out
Virtual Consoles
Logging in with a Graphical User Interface

Correcting Mistakes

Erasing Characters
Deleting a Line
Deleting a Word
Aborting Program Execution

Using man or xman to Display the System Manual
Using info to Display System Information
Using joe to Create and Edit a File

Starting joe
Entering Text
Getting Help
Correcting Text
Ending the Editing Session

Listing the Contents of a Directory
Displaying a Text File
Deleting a File
Special Characters

Quoting Characters

Summary
Review Exercises

CHAPTER 3

An Introduction to the Utilities

File Operations

Using cp to Copy a File
Using mv to Change the Name of a File
Using lpr to Print a File
Using grep to Find a String
Using head to Look at the Top of a File
Using tail to Look at the End of a File
Using sort to Display a File in Order
Using uniq to Remove Duplicate Lines in a File
Using diff to Compare Two Files
Using file to Test a File's Contents

Using echo to Display Text on the Terminal
Using date to Display the Time and Date
Saving Space By Compressing Files

Using gzip to Shrink Files
Using gunzip and zcat to Expand Files

Using tar to Unpack Archived Software
Finding Utilities and Other Files

Using which and whereis to Find Utilities
Using apropos to Search for Keywords

Obtaining User and System Information

Using who
Using finger
Using w

Communicating With Other Users

Using write to Send a Message
Using talk to Communicate With Another User
Using mesg to Deny or Accept Messages
Using pine to Send and Receive Electronic Mail

Starting pine
Sending Mail Using pine
Receiving Mail Using pine
Sending Mail to More Than One Person

Summary
Review Exercises

CHAPTER 4

The Linux Filesystem

The Hierarchical Filesystem

Using the Hierarchical Filesystem

Directory and Ordinary Files

Filenames

Filename Extensions
Invisible Filenames

Creating a Directory
The Working Directory
Your Home Directory

Startup Files
The . and .. Directory Entries

Absolute Pathnames
Relative Pathnames
Important Standard Directories and Files

Working with Directories

Changing to Another Working Directory

Significance of the Working Directory

Deleting a Directory
Using Pathnames

Special Pathnames

Moving and Copying Files from One Directory to Another
Moving Directories

Access Permissions

The ls Utility with the -l Option
Changing Access Permissions
Directory Access Permissions

Links

Creating Additional Links
Using ln to Create a Link
Removing Links
Symbolic Links

Creating a Symbolic Link
Using Symbolic Links to Change Directories
Removing Hard and Symbolic Links

Summary
Review Exercises

CHAPTER 5

The Shell

The Command Line

Command-Line Syntax

Command Name
Arguments

Processing the Command Line
Executing the Command Line

Standard Input and Standard Output

The Terminal as a File
The Terminal as Standard Input and Standard Output

Redirection

Redirecting Standard Output
Redirecting Standard Input
Appending Standard Output to a File
Using /dev/null

Pipes

Filters
The tee Utility

Running a Program in
the Background
Filename Generation/Pathname Expansion

The ? Special Character
The j Special Character
The [] Special Characters

Summary
Review Exercises

CHAPTER 6

Graphical User Interfaces (GUIs)

What Is a GUI?

Components of a GUI

Windows
The Root Window
Title Bars
Buttons
Sliders
Scroll Bars
Icons
Menus
Dialog Boxes

Screen Layout
Window Manager
Desktop Manager
Workspace Manager

The X Window System

Remote Computing and Local Displays
X Window System Managers
How the X Window System Works with Linux

Virtual Consoles
Bringing up the X Server
Stopping the X Server
Other Features of the X Server

The Andrew User Interface System

Using the fvwm Window Manager

Selecting the Active Window
Opening a Window

The fvwm Title Bar
Common Operations--The Window Ops Menu

Closing a Window
Moving a Window
Changing Window Size
Raising and Lowering Windows
Copying and Pasting Text
Using Icons

Using the Motif Window Manager

Copying and Pasting Text
Scrolling Text

The Standard Motif Scroll Bar
The Athena Scroll Bar

Customizing Your X Work Environment

Remapping Mouse Buttons
Customizing X Applications

The .xinitrc File

Setting X Resources

Customizing the fvwm Window Manager

The .fvwmrc File

Setting the Major Operating Modes
Setting the Virtual Desktop Configuration
GoodStuff
Application-Specific Customizations
Building Menus for fvwm

Customizing the Motif Window Manager

The .mwmrc file

X Applications
Summary
Review Exercises

CHAPTER 7

Networking and the Internet

Background

Network Services
Intranets

Common Types of Networks

Local Area Networks (LANs)

Ethernet
FDDI

Wide Area Networks (WANs)
Internetworking Through Gateways and Routers
Network Protocols
Host Addresses

Communicating Over the Network

Using finger to Learn About Remote Users
Sending Mail to a Remote User
Using talk with a Remote User

Networking Utilities

Using rlogin and telnet to Access a Remote Computer
Trusted Hosts and the .rhosts File
Using rcp and ftp to Transfer Files over a Network
Using rsh to Run a Command Remotely
Using ping to Test a Network Connection
Using rwho to List Users on Remote Computers

Distributed Computing

The Client/Server Model
Overview of Domain Name Service (DNS)
Network Information Service (NIS)
Network File System (NFS)

Network Services/Daemons
Internet Services

USENET

Netnews
Using pine as a Newsreader

Browsing Around the Internet

Archie
Gopher

Overview of the World Wide Web

Netscape Basics

Screen Elements
Navigating the Web
Using Netscape to Read Netnews
Using Netscape to Download Files
Bookmarks

Search Engines
Other WWW Browsers
More About URLs
Creating Your Own Web Page

Summary
Review Exercises

CHAPTER 8

The vi Editor

About vi
Getting Started: Using vi to Create and Edit a File

Specifying a Terminal
An Editing Session

Starting vi
Command and Input Modes
Entering Text
Ending the Editing Session

Introduction to vi Features

Simple Online Help
Modes of Operation
The Display

The Status Line
Redrawing the Screen
The Tilde (~) Symbol

Correcting Text as You Insert It
Command Case
The Work Buffer
Number Increment
Line Length and File Size
Split Screens
Background and Foreground Screens
File Locking
Abnormal Termination of an Editing Session
Recovering Text After a Crash

Command Mode--Moving the Cursor

Moving the Cursor by Characters
Moving the Cursor to a Specific Character
Moving the Cursor by Words
Moving the Cursor by Lines
Moving the Cursor by Sentences and Paragraphs
Moving the Cursor Within the Screen
Viewing Different Parts of the Work Buffer

Input Mode

The Insert Commands
The Append Commands
The Open Commands
The Replace Commands
The Quote Command

Command Mode--Deleting and Changing Text

The Undo Command
The Delete Character Command
The Delete Command
The Change Command

Searching and Substituting for a String

The Search Commands

Special Characters in Search Strings

Word Search
Substituting One String for Another

The Substitute Address
The Search and Replacement Strings

Miscellaneous Commands
The Yank, Put, and Delete Commands

The General-Purpose Buffer

The Yank Command
The Put Commands
The Delete Commands

Reading and Writing Files

The Read Command
The Named Buffers
The Write Command
Identifying the Current File

Setting Parameters

Setting Parameters from vi
Setting Parameters in a Startup File
Parameters

Advanced Editing Techniques

Using Markers
Editing Other Files
Executing Shell Commands from vi

Units of Measure

Character
Word
Blank-Delimited Word
Line
Sentence
Paragraph
Screen
Repeat Factor

Summary

Starting vi
Getting Help
Moving the Cursor by Units of Measure
Viewing Different Parts of the Work Buffer
Adding Text
Deleting and Changing Text
Searching for a String
Substituting for a String
Miscellaneous Commands
Yanking and Putting Text
Advanced Commands

Review Exercises

CHAPTER 9

The emacs Editor

About emacs

emacs vs. vi

Getting Started

Starting emacs
Stopping emacs
Inserting Text
Moving the Cursor

Moving the Cursor by Characters
Moving the Cursor by Words
Moving the Cursor by Lines
Moving the Cursor by Sentences, Paragraphs,
and Window Position

Editing at the Cursor Position
Saving and Retrieving the Buffer

Basic Editing Commands

Keys: Notation and Use
Key Sequences and Commands
Running a Command Without a Key Binding: META-x
Numeric Arguments
Point and the Cursor
Scrolling Through a Buffer
Erasing Text
Searching

Incremental Searches
Nonincremental Searches
Regular Expression Searching

Online Help
Advanced Editing Topics

Undoing Changes
Mark and Region
Cutting and Pasting: Yanking Killed Text
Inserting Special Characters
Global Buffer Commands

Line-oriented Operations
Unconditional and Interactive Replacement

Working with Files

Visiting Files
Saving Files

Working with Buffers
Working with Windows

Window Creation by Splitting
Manipulating Windows
Other-Window Display
Adjusting and Deleting Windows

Foreground Shell Commands
Background Shell Commands

Language-Sensitive Editing

Selecting a Major Mode
Human-Language Modes

Working with Words
Working with Sentences
Working with Paragraphs
Filling
Case Conversion
Text Mode

C Mode

Working with Expressions
Function Definitions
Indention

Customizing Indention for Version 19

Comment Handling

Special-Purpose Modes

Shell Mode

Customizing emacs

The .emacs Startup File
Remapping Keys
A Sample .emacs File for Version 19

emacs and The X Window System

Mouse Commands for Cut and Paste
Mouse-2 Selections
Scroll Bars
Window Manipulation with the Mouse
Frame Management

Manipulating Frames
Switching to Another Frame

Menu Bars

Resources for emacs

USENET emacs FAQ (Frequently Asked Questions)
Access to emacs

Summary

Moving the Cursor
Killing and Deleting
Searching
Online Help
Region
Working with Lines
Unconditional and Interactive Replacement
Responses to Replacement Queries
Working with Windows
Working with Files
Working with Buffers
Foreground Shell Commands
Background Shell Commands
Case Conversion
C Mode
Shell Mode

Review Exercises

CHAPTER 10

The Bourne Again Shell

Background

POSIX Shells

Creating a Simple Shell Script

Making a File Executable

Command Separation and Grouping

The NEWLINE and ; Characters
The \ Character
The | and & Characters
Command Grouping

Redirecting Standard Error
Job Control

Using jobs to List Jobs
Using fg to Bring a Job to the Foreground
Using bg to Put a Job into the Background

Directory Stack Manipulation

Using dirs to Display the Contents of the Stack
Using pushd to Push Directories onto the Stack
Using popd to Remove a Directory from the Stack

Processes

Process Structure
Process Identification
Executing a Command
Invoking a Shell Script

Specifying a Shell
Comments
Startup Files

Parameters and Variables

User-Created Variables

Removing Variables
The readonly Builtin
The export Builtin
The declare Builtin
The read Builtin
Command Substitution

Keyword Variables

HOME
PATH
MAIL
PS1
PS2
CDPATH
Running .bash_profile with the . (Dot) Command

Positional Parameters

Name of the Calling Program
Command-Line Arguments
The shift Builtin
The set Builtin

Special Parameters

Information About Arguments
PID Numbers
Exit Status

History

Using the fc Builtin

Viewing the History List
Editing and Reexecuting Previous Commands
Reexecuting Previous Commands
Without Calling the Editor

Using the Classic C Shell History Mechanism

Reexecuting Events
Reexecuting the Previous Event
Using Event Numbers
Using Event Text
Words Within Events
Modifying Previous Events

Alias

Single vs. Double Quotation Marks
Examples

Command-Line Expansion

Brace Expansion
Tilde Expansion
Parameter Expansion
Variable Expansion
Command Substitution
Arithmetic Expansion
Word Splitting
Pathname Expansion
Order of Expansion

Command-Line Editing

The Readline Library
Basic Readline Commands
Other Commands

Completion

The .inputrc File

Summary
Review Exercises

CHAPTER 11

Shell Programming

Control Structures

if...then
if...then...else
if...then...elif
for...in
for
while
until
break and continue
case

The Here Document
Expanding NULL or Unset Variables

Use Default Value
Assign Default Value

Builtins

The exec Builtin
Display Error Message
The trap Builtin
A Partial List of Builtins

Functions
Summary
Review Exercises

CHAPTER 12

The TC Shell

Background
Shell Scripts
Entering and Leaving the TC Shell

Startup Files

Features Found in Both the Bourne Again and TC Shells

History
Differences Between the tcsh and bash alias Mechanisms
Alias
Job Control
Filename Substitution
Directory Stack Manipulation

Redirecting standard Error
Word Completion

Filename Completion
Tilde Completion
Command and Variable Completion

Command-line Editing
Spelling Correction
Variables

Variable Substitution
String Variables
Arrays of String Variables
Numeric Variables

Expressions
Arrays of Numeric Variables

Braces
Special Variable Forms

Reading User Input

Shell Variables

Shell Variables That Take on Values
Shell Variables That Act as Switches

if
goto
Interrupt Handling
if...then...else

Form 1
Form 2
Form 3

foreach
while
break and continue
switch

Builtins
Summary
Review Exercises

CHAPTER 13

The Z Shell and
Advanced Shell Programming

Background

The Z Shell, Korn Shell, and Pd-ksh
Z Shell Basics
Running Scripts
Startup Files

Variables

Variable Attributes
Locality of Variables
Keyword Variables

Controlling the Prompt

Expanding Shell Variables

String Pattern Matching
Other Operators
Special Flags
Filename Generation

Array Variables
Arithmetic

Operators

Builtins

Control Structures

select
repeat
Alternate Syntax for Control Structures

Option Processing

The getopts Builtin

Input and Output

The read Builtin
The print Builtin

File Descriptors
Functions

Special Functions

Job Control

alias
kill
whence
trap

Command-Line Editing

Using the vi Command-Line Editor

Pathname Operations

Using the emacs Command-Line Editor
History

Using the vi Command-Line Editor on
Previous Commands

Using the fc Builtin

Command Processing

Token Splitting
History Substitution
Alias Substitution
Filename Expansion
Process Substitution
Command Substitution
Parameter Expansion
Arithmetic Expansion
Brace Expansion
Filename Generation
Processing Quotation Marks
I/O Redirection and the Coprocess
Spelling Correction

Shell Programs

Program Structures

Recursion

A Programming Problem: makercs
Another Programming Problem: quiz

Z Shell Options
Summary

Commands for the vi Command-Line Editor

Cursor-Movement Commands (vi)
Changing Text (vi)
History Editing Commands (vi)
Miscellaneous Commands (vi)

Commands for emacs command-line editor

Cursor-Movement Commands (emacs)
Changing Text (emacs)
History Editing Commands (emacs)
Miscellaneous Commands (emacs)

Review Exercises

CHAPTER 14

Programming Tools

Background
Programming In C

A C Programming Example
Compiling and Linking a C Program

The make Utility

Implied Dependencies
Macros
Debugging C Programs

Using C Compiler Warning Options
to Find Errors in a Program
Using a Symbolic Debugger

System Calls

Controlling Processes
Accessing the Filesystem

Source Code Management

The Revision Control System (RCS)

The ci Utility
The co Utility
The rlog Utility
Using the -r Option to Specify a Revision
Changing Attributes of an RCS File
Checking Differences Between RCS Files

The Concurrent Versions System (CVS)

How CVS Stores Revision Files
Built-in CVS Help
The Basic CVS Commands
Other CVS Commands
Adding a Module to the Repository
CVS Administration
Using tkcvs

Summary
Review Exercises

CHAPTER 15

System Administration

Background
The System Administrator and the Superuser

System Administration Tools

Types of Files

Ordinary Versus Directory Files
Symbolic Links
Special Files

Fifo Special Files
Sockets
Block and Character Devices

Detailed Description of System Operation

Bringing Up (Booting) the System

Single-User Mode
Maintenance
Going Multiuser

Multiuser Mode

Logging In
Running a Program and Logging Out

Bringing the System Down
Crashes

Important Files and Directories
Day-to-Day System Administration

Backing Up Files

What to Use for Backing Up Your System
The tar, cpio, and afio Utilities
Performing Simple Backups
Using taper to Maintain Backups

Checking Your Mail and Log Files
Scheduling Routine Tasks
Getting Information to Users

Periodic System Administration

Installing Linux
Rebuilding the Linux Operating System
Installing New Software and Upgrades
Managing Printers
Adding and Removing User Accounts

Removing a User Account

Preventing and Fixing Problems

When a User Cannot Log In
Keeping a Machine Log
Keeping the System Secure
Monitoring Disk Usage

Growing Files
Removing Unused Space from a Directory

What Can Go Wrong

Some Useful Utilities

Simple Commands
Mounting and Unmounting Filesystems
Creating and Modifying Disk Partitions
Using lilo to Boot Linux
Building Software Packages

Getting Help
Review Exercises

PART II

sample

This utility is a sample of how other utilities
are laid out in this book

afio

Creates an archive or restores files from an archive

at

Executes a shell script at a time you specify

awk

Searches for and processes patterns in a file

cal

Displays a calendar

cat

Joins or displays files

cd

Changes to another working directory

chgrp

Changes the group associated with a file

chmod

Changes the access mode of a file

chown

Changes the owner of a file

ci

Creates or records changes in an RCS file

cmp

Checks two files to see if they differ

co

Retrieves an unencoded revision of an RCS file

comm

Compares sorted files

configure

Automatically configures software source code

cp

Copies one or more files

cpio

Creates an archive or restores files from an archive

crontab

Schedules a command to run at a
regularly specified time

cut

Selects characters or fields from input lines

cvs

Manages concurrent access to files in a hierarchy

date

Displays or sets the time and date

dd

Copies a file from one device to another device

df

Displays the amount of available disk space

diff

Displays the differences between two files

du

Displays information on disk usage

echo

Displays a message

expr

Evaluates an expression

file

Displays the classification of a file

find

Finds files based on various criteria

finger

Displays detailed information on users

fmt

Formats text very simply

fsck

Checks and repairs a filesystem

ftp

Transfers files over a network

gcc

Compiles cc, gcc, g++, C, and C++ programs

grep

Searches for a pattern in files

gzip

Compresses or decompresses files

head

Displays the beginning of a file

ispell

Checks a file for spelling errors

kill

Terminates a process

less

Displays text files, one screenful at a time

ln

Makes a link to a file

lpr

Prints files

ls

Displays information about one or more files

mail

Send or receive electronic mail

make

Keeps a set of programs current

man

Displays documentation for commands

mesg

Enables/disables reception of messages

mkdir

Makes a directory

Mtools

Uses DOS-style commands on files and directories

mv

Moves (renames) a file

nice

Changes the priority of a command

nohup

Runs a command that keeps running after you log out

od

Dumps the contents of a file

paste

Joins corresponding lines from files

patch

Updates source code

pine

Sends and receives electronic mail and news

pr

Paginates files for printing

ps

Displays process status

rcp

Copies one or more files to or from
a remote computer

rcs

Creates or changes the attributes of an RCS file

rlog

Prints a summary of the history of an RCS file

rlogin

Logs in on a remote computer

rm

Removes a file (deletes a link)

rmdir

Removes a directory

rsh

Executes commands on a remote computer

rwho

Displays names of users on computers
attached to a network

sed

Edits a file (not interactively)

sleep

Creates a process that sleeps for a specified interval

sort

Sorts and/or merges files

stty

Displays or sets terminal parameters

tail

Displays the last part (tail) of a file

tar

Stores or retrieves files to/from an archive file

tee

Copies standard input to standard output
and one or more files

telnet

Connects to a remote computer over a network

test

Evaluates an expression

top

Dynamically displays process status

touch

Updates a file's modification time

tr

Replaces specified characters

tty

Displays the terminal pathname

umask

Establishes the file-creation permissions mask

uniq

Displays lines of a file that are unique

w

Displays information on system users

wc

Displays the number of lines, words,
and characters in a file

which

Shows where a command is located in your path

who

Displays names of users

write

Sends a message to another user

xargs

Converts standard output of one command
into arguments for another

APPENDIX A

Regular Expressions

Characters
Delimiters
Simple Strings
Special Characters

Period
Square Brackets
Asterisk
Caret and Dollar Sign
Quoting Special Characters

Rules

Longest Match Possible
Empty Regular Expressions

Bracketing Expressions
The Replacement String

Ampersand
Quoted Digit

Extended Regular Expressions

Summary

Appendix B

Help!

Where Can I Find Linux Documentation on My System? 913
What Are Some Useful Linux Internet Sites? 915
How do I use ftp to Get Linux Software and Documentation? 916
How Do I Download the joe editor? 916
How Do I Obtain, Build, and Install Software? 919
How Do I Download Software From the Internet? 920
How Do I Install the Software Source Code? 921
How Do I Build the Software? 922
How Do I Install the Compiled Software? 924
How Do I Make a Rescue Disk? 925
How Do I Specify the Terminal I Am Using? 926
How Do I Send Files to a Printer? 926
What Is My Login Name? 927
What Is My Password? 927
Which Key Ends a Line? 927
Which Is the Erase Key? 928
Which Is the Line Kill Key? 928
Which Key Interrupts Execution? 928
What Is the Termcap or Terminfo Name for My Terminal? 928
Which Shell Will I Be Using? 928

Appendix C

Emulators: Running Software
from Other Operating Systems

dosemu
wine
wabi
executor
iBCS

APPENDIX D

The POSIX Standards

Background
POSIX.1

The POSIX.1 FIPS

POSIX.2

Localization
The POSIX Shell
Utilities for Portable Shell Applications

cksum
command
getconf
locale
localedef
logger
mkfifo
pathchk
pax
printf

The User Portability Utilities Option (UPE)
Software Development Utilities

POSIX.3
POSIX.4
POSIX.5
POSIX.9

System Administration

Draft POSIX Standards

Security
Networks

Profiles and POSIX Standards
Summary

Glossary

Index


Last Modified: April 3, 1997