<<

. 2
( 69 .)



>>

Rename a File ....................................................................................................................22
Delete a File ........................................................................................................................23
Change File Permissions ....................................................................................................24
Select Files Using Wildcards ............................................................................................26
Select Files Using Completion ..........................................................................................27
Find Files By Name ............................................................................................................28


3) WORK WITH DIRECTORIES
Change the Current Directory ........................................................................................30
Create a Directory ............................................................................................................32
Delete a Directory ............................................................................................................34
Move Files into a Directory ..............................................................................................36
Copy a Directory ................................................................................................................37
Determine Directory Size ................................................................................................38


4) WORK WITH TEXT
View Text Files ....................................................................................................................40
Create a Simple Text File ..................................................................................................41
View Text Files as Pages ....................................................................................................42

vi
Unix for Mac:
Your visual blueprint to maximizing
the foundation of Mac OS X




View Portions of a Text File ..............................................................................................44
Extract Text from a File ......................................................................................................46
Redirect Text to a File ........................................................................................................48
Chain Text Commands Together ......................................................................................50
Compare Text Files ............................................................................................................52
Count Characters, Lines, and Words in Text ..................................................................54
Arrange Text in Columns ..................................................................................................55
Sorting Text ........................................................................................................................56
Print Text on a Printer ........................................................................................................58


5) WORK WITH TEXT EDITORS
Open a File with Pico ........................................................................................................60
Edit a File with Pico ..........................................................................................................62
Open a File with vi ............................................................................................................64
Movement Within vi ..........................................................................................................66
Enter Text in vi ....................................................................................................................68
Delete Text in vi ................................................................................................................70
Edit Text with vi ..................................................................................................................72
Save a File with vi ..............................................................................................................74
Open a File with emacs ....................................................................................................76
Edit a File with emacs ........................................................................................................78


6) CUSTOMIZE YOUR SHELL
Set Your Prompt ................................................................................................................80
Set Command Aliases ........................................................................................................82
Set Shell Variables ..............................................................................................................84
Set Environment Variables ................................................................................................86
Set Your Path ......................................................................................................................88
Edit Your .tcshrc File ..........................................................................................................89
Recall Your Command History ........................................................................................90
Start a New Shell ..............................................................................................................92
Change Your Shell ..............................................................................................................93
Work with the Bourne-Again Shell ..................................................................................94
Work with the Z Shell ......................................................................................................95


7) WORK WITH PROCESSES
Suspend the Current Process ..........................................................................................96
Restart a Process ................................................................................................................98
vii
TABLE OF CONTENTS


Run a Process in the Background ..................................................................................100
Kill a Process ....................................................................................................................102
List Active Processes ........................................................................................................104
Monitor the Top Processes ............................................................................................106


8) AUTOMATE SHELL TASKS
Write a Simple Shell Script ............................................................................................108
Run a Simple Shell Script ................................................................................................110
Write Looping Shell Scripts ............................................................................................112
Write A Conditional Shell Script ....................................................................................114
Extract Information with awk ........................................................................................116
Extend Scripts with sed ..................................................................................................118
Schedule Scripts to Run Automatically ........................................................................120


9) COMBINE UNIX AND AQUA
Open Aqua Applications from the Shell ........................................................................122
Capture a Screenshot from Unix ....................................................................................124
Access the Aqua Clipboard ............................................................................................126
Copy Apple Resource Forks ............................................................................................128
Run Applescript from the Shell ......................................................................................130
Create Clickable Shell Scripts ........................................................................................132
Drag Pathnames to the Terminal Window ....................................................................133


10) WORK WITH INTERNET COMMANDS
Connect to the Internet ..................................................................................................134
Look Up an Internet Address ..........................................................................................136
Look Up Domain Information ........................................................................................138
Examine Your Network Connection ..............................................................................140
Check that Another Computer Is Reachable ................................................................142
Log on to Another Computer ........................................................................................144
Transfer Files ....................................................................................................................146
Access Another Computer Securely ..............................................................................148
Download Web Files ......................................................................................................150
Enable Remote Access to Your Computer ....................................................................152




viii
Unix for Mac:
Your visual blueprint to maximizing
the foundation of Mac OS X




11) SYSTEM ADMINISTRATION COMMANDS
Introduction to System Administration ........................................................................154
Shut Down and Restart the Computer ..........................................................................156
Create a New User ..........................................................................................................158
Enable the Root User Account ........................................................................................160
Execute Commands as Root ..........................................................................................162
Back Up Your Files ..........................................................................................................164
Change File Ownership ..................................................................................................166
Create Symbolic Links ....................................................................................................168
Check Disk Usage ............................................................................................................170
Manage the Print Queue ................................................................................................172
Inspect System Logs ........................................................................................................174
Compress Large Files ......................................................................................................176
Using NetInfo ..................................................................................................................178


12) INSTALL UNIX APPLICATIONS
Install Developer Tools ....................................................................................................180
Find Unix Applications on the Web ..............................................................................186
Using Open Source Software ........................................................................................188
Find Open Source Software ..........................................................................................189
Install Application Packages ..........................................................................................190
Install TAR Archives ..........................................................................................................192
Compile a Program with make ......................................................................................194
Compile Apache ..............................................................................................................196
Manage Software Installation with Fink ........................................................................198
Manage Fink with FinkCommander ..............................................................................200
Install Libraries ................................................................................................................202


13) INSTALL AND USE INTERNET APPLICATIONS
Install the Lynx Browser ..................................................................................................204
Browse the Web with Lynx ............................................................................................206
Install Wget ......................................................................................................................208
Download Web Sites with Wget ....................................................................................209
Install an IRC Client ........................................................................................................210




ix
TABLE OF CONTENTS


Chatting on IRC ..............................................................................................................212
Configure Sendmail ........................................................................................................214
Send E-mail from UNIX ..................................................................................................218
Look at Your Mail File ......................................................................................................220
Fetch E-mail from Other Servers ....................................................................................221
Install Pine ........................................................................................................................222
Read E-mail with Pine ....................................................................................................224
Send E-mail with Pine ....................................................................................................226


14) SERVE WEB PAGES WITH APACHE
Introduction to Apache ..................................................................................................228
Start Apache ....................................................................................................................230
Stop Apache ....................................................................................................................231
Configure Apache ............................................................................................................232
Set Up Your Document Directory ..................................................................................234
Create a Simple Web Site ..............................................................................................235
Introduction to HTML ....................................................................................................236
Create a Structured Web Page ......................................................................................238
Add Simple Styles to Your Web Site ..............................................................................240
Install CGI Scripts ............................................................................................................242
Install Apache Modules ..................................................................................................244
Write PHP Applications ..................................................................................................246
Analyze Web Traffic ........................................................................................................248


15) WORK WITH PERL
Write a Simple Perl Script ..............................................................................................250
Run a Perl Script ..............................................................................................................252
Manipulate Text with Perl ..............................................................................................254
Read the Command Line ................................................................................................256
Read Files with Perl ..........................................................................................................258
Write Files with Perl ........................................................................................................260
Install Perl Modules ........................................................................................................262
Write a CGI Script ............................................................................................................266




x
Unix for Mac:
Your visual blueprint to maximizing
the foundation of Mac OS X




16) RUN THE X WINDOW SYSTEM
Introduction to the X Window System ..........................................................................268
Get X Software for Mac OS X ........................................................................................270
Install an X Server ............................................................................................................274
Install XFree86 Upgrades ................................................................................................276
Start XFree86 in Rootless Mode ....................................................................................278
Run the Gnome Desktop ................................................................................................280
Explore GNOME Applications ........................................................................................282
Install OroborOSX ..........................................................................................................284


17) INSTALL X WINDOW SYSTEM SOFTWARE
View Images with xv ........................................................................................................286
Edit Images with GIMP ....................................................................................................288
Word Processing with AbiWord ....................................................................................292
Create Spreadsheets in Gnumeric ................................................................................294
View Office Documents with Open Office ..................................................................296
Create Spreadsheets with Open Office ........................................................................298


18) DEVELOP UNIX APPLICATIONS
Develop C and C++ Applications ..................................................................................300
Develop Java Applications ..............................................................................................302
Develop Python Applications ........................................................................................304
Develop Ruby Applications ............................................................................................306
Run a Database on Mac OS X ........................................................................................308
Write SQL Commands ....................................................................................................312
Access Databases from PHP ..........................................................................................314


APPENDIX
What's on the CD-ROM ................................................................................................316
Using the E-Version of the Book ....................................................................................318


INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326




xi
HOW TO USE THIS BOOK



Unix for Mac: Your visual blueprint to maximizing the Bold
foundation of Mac OS X uses straightforward examples to Indicates information that must be typed by you.
teach you how to get the most out of your Mac OS X
system by fully using its Unix capabilities.
To get the most out of this book, you should read each Italics
chapter in order from beginning to end. Each chapter Indicates a new term being introduced.
introduces new ideas and builds on the knowledge
learned in previous chapters. After you become familiar
with Unix for Mac, you can use this book as an informative
desktop reference.

<<

. 2
( 69 .)



>>