search for books and compare prices
Tables of Contents for Unix and Shell Programming
Chapter/Section Title
Page #
Page Count
PART I
Introduction
3
38
Why UNIX?
3
1
Portable
3
1
Multiuser
3
1
Multitasking
3
1
Networking
4
1
Organized File System
4
1
Device Independence
4
1
Utilities
4
1
Services
4
1
Computer System
4
2
Hardware
5
1
Software
5
1
The Operating System
6
1
The UNIX Environment
6
2
Personal Environment
6
1
Time-Sharing Environment
7
1
Client/Server Environment
7
1
UNIX Structure
8
2
The Kernel
8
1
The Shell
8
1
Utilities
9
1
Applications
10
1
Accessing UNIX
10
3
User ID
10
1
Passwords
10
1
Interactive Session
11
2
Commands
13
2
Basic Concepts
13
2
Common Commands
15
9
Date and Time (date) Command
15
2
Calendar (cal) Command
17
1
Who's Online (who) Command
18
2
whoami
20
1
Change Password (passwd) Command
20
1
Print Message (echo) Command
21
1
Online Documentation (man) Command
22
1
Print (lpr) Command
23
1
Other Useful Commands
24
8
Terminal (tty) Command
24
1
Clear Screen (clear) Command
25
1
Set Terminal (stty) Command
25
2
Record Session (script) Command
27
1
System Name (uname) Command
28
1
Calculator (bc) Command
29
3
Key Terms
32
1
Tips
32
1
Commands
33
1
Summary
34
1
Practice Set
35
2
Review Questions
35
1
Exercises
36
1
Lab Sessions
37
4
Basic vi Editor
41
24
Editor Concepts
41
1
Line Editors
41
1
Screen Editors
41
1
The vi Editor
42
1
Modes
42
2
Command Mode
43
1
Text Mode
43
1
Changing Modes
43
1
Commands
44
11
Add Commands
44
2
Cursor Move Commands
46
4
Deletion Commands
50
1
Join Command
50
1
Scrolling Commands
51
2
Undo Commands
53
1
Saving and Exit Commands
54
1
Two Practice Sessions
55
2
Key Terms
57
1
Tips
57
1
Commands
57
1
Summary
58
2
Practice Set
60
2
Review Questions
60
1
Exercises
60
2
Lab Sessions
62
3
File Systems
65
56
Filenames
65
3
Wildcards
66
2
File Types
68
1
Regular Files
69
1
Text Files
69
1
Binary Files
69
1
Directories
70
5
Special Directories
70
1
Paths and Pathnames
71
1
Relative Pathname Abbreviations
72
3
File System Implementation
75
5
File Systems
76
1
Directory Contents
77
1
Links
77
3
Operations Unique to Directories
80
9
Locate Directory (pwd) Command
80
1
List Directory (ls) Command
81
5
Make Directory (mkdir) Command
86
2
Change Directory (cd) Command
88
1
Remove Directory (rmdir) Command
89
1
Operations Unique to Regular Files
89
4
Create File
89
1
Edit File
89
1
Display File (more) Command
90
2
Print File
92
1
Operations Common to Both
93
19
Copy (cp) Command
93
7
Move (mv) Command
100
2
Rename (mv) Command
102
1
Link (ln) Command
102
4
Remove (rm) Command
106
6
Key Terms
112
1
Tips
112
1
Commands
113
1
Summary
114
1
Practice Set
115
4
Review Questions
115
1
Exercises
116
3
Lab Sessions
119
2
Security and File Permission
121
22
Users and Groups
121
1
Group (groups) Command
121
1
Security Levels
122
4
System Security
122
1
Permission Codes
123
3
Checking Permissions
126
1
Changing Permissions
126
5
Symbolic Codes
127
1
Octal Codes
128
2
Option
130
1
User Masks
131
1
Basic Concept
131
1
User Mask (umask) Command
132
1
Changing Ownership and Group
132
2
Change Ownership (chown) Command
133
1
Change Group (chgrp) Command
133
1
Key Terms
134
1
Commands
134
1
Tips
135
1
Summary
135
1
Practice Sets
136
4
Review Questions
136
2
Exercises
138
2
Lab Sessions
140
3
Introduction to Shells
143
58
UNIX Session
144
2
Login Shell Verification
145
1
Current Shell Verification
145
1
Shell Relationships
145
1
Logout
146
1
Standard Streams
146
1
Redirection
147
4
Redirecting Input
147
1
Redirecting Output
148
1
Redirecting Errors
149
2
Pipes
151
2
tee Command
153
1
Command Execution
154
2
Sequenced Commands
155
1
Grouped Commands
155
1
Chained Commands
156
1
Conditional Commands
156
1
Command-Line Editing
156
3
Command-Line Editing Concept
157
1
Editor Selection
157
1
vi Command-Line Editor
157
2
Using the Command-Line Editor
159
1
Quotes
159
5
Backslash
160
1
Double Quotes
161
2
Single Quotes
163
1
Command Substitution
164
1
Job Control
165
5
Jobs
165
1
Foreground and Background Jobs
165
3
jobs Command
168
2
Process ID
170
1
Aliases
170
6
Aliases in the Korn and Bash Shells
171
3
Aliases in the C Shell
174
2
Alias Summary
176
1
Variables
176
2
User-Defined Variables
176
1
Predefined Variables
177
1
Storing Data in Variables
177
1
Accessing a Variable
178
1
Predefined Variables
178
5
Handling Variables
181
2
Options
183
2
Handling Options
184
1
Shell/Environment Customization
185
3
Temporary Customization
185
1
Permanent Customization
185
2
Summary
187
1
Key Terms
188
1
Tips
188
1
Commands
189
2
Summary
191
1
Practice Set
192
5
Review Questions
192
1
Exercises
193
4
Lab Sessions
197
4
Filters
201
56
Filters and Pipes
202
1
Concatenating Files
202
5
Catenate (cat) Command
202
3
cat Options
205
2
Display Beginning and End of Files
207
3
head Command
207
1
tail Command
208
2
Cut and Paste
210
7
cut Command
210
4
paste Command
214
3
Sorting
217
13
sort Command
217
1
Sort by Lines
217
2
Sort by Fields
219
3
Options
222
5
Multiple-Pass Sorting
227
3
Translating Characters
230
3
tr Command
230
1
Simple Translate
230
1
Nonmatching Translate Strings
231
1
Delete Characters
231
1
Squeeze Output
231
1
Complement
232
1
Files with Duplicate Lines
233
4
uniq Command
233
1
Output Format
234
2
Skip Leading Fields
236
1
Skip Leading Characters
236
1
Count Characters, Words, or Lines
237
1
wc Command
237
1
Comparing Files
238
6
Compare (cmp) Command
238
2
Difference (diff) Command
240
3
Common (comm) Command
243
1
Key Terms
244
1
Tips
244
1
Commands
245
1
Summary
246
1
Practice Set
247
5
Review Questions
247
1
Exercises
248
4
Lab Sessions
252
5
Communications
257
34
User Communication
257
5
talk Command
257
3
write Command
260
2
Electronic Mail
262
14
Mail Addresses
262
3
Mail Mode
265
1
mail Command
265
1
Send Mail
265
5
Read Mode
270
5
Read Mail Options
275
1
Mail Files
275
1
Remote Access
276
3
The telnet Concept
276
2
Connecting to the Remote Host
278
1
File Transfer
279
3
The ftp Command
279
1
Establishing ftp Connection
280
1
Closing an ftp Connection
280
1
Transferring Files
281
1
Key Terms
282
1
Commands
283
1
Tips
283
1
Summary
284
1
Practice Set
285
2
Review Questions
285
1
Exercises
286
1
Lab Sessions
287
4
vi and ex
291
40
vi Editor
292
1
Commands
292
1
Command Categories
293
1
Local Commands in vi
293
6
Insert Text Commands (i, I)
293
1
Append Text Commands (a, A)
293
1
Newline Commands (o, O)
294
1
Replace Text Commands (r, R)
294
1
Substitute Text Commands (s, S)
295
1
Delete Character Commands (x, X)
295
1
Mark Text Command (m)
296
1
Change Case Command (~)
296
1
Put Commands (p, P)
297
1
Join Command (J)
298
1
Range Commands in vi
299
8
Text Object
299
5
Text Object Commands
304
2
Yank Command
306
1
Range Command Summary
307
1
Global Commands in vi
307
2
Scroll Commands
307
1
Undo Commands
307
1
Repeat Command
308
1
Screen Regeneration Commands
308
1
Display Document Status Line
308
1
Save and Exit Commands
309
1
Rearrange Text in vi
309
2
Move Text
309
1
Copy Text
309
1
Named Buffers
310
1
ex Editor
311
9
ex Instruction Format
311
1
Addresses
312
4
Commands
316
4
Key Terms
320
1
Tips
320
1
Commands
321
2
Summary
323
1
Practice Set
324
2
Review Questions
324
1
Exercises
325
1
Lab Sessions
326
5
Regular Expressions
331
20
Atoms
331
4
Single Character
332
1
Dot
332
1
Class
333
1
Anchors
334
1
Back References
335
1
Operators
335
8
Sequence
335
2
Alternation
337
1
Repetition
337
4
Group Operator
341
1
Save
342
1
Key Terms
343
1
Tips
343
1
Summary
344
1
Practice Set
344
7
Review Questions
344
1
Exercises
345
6
grep
351
22
Operation
351
3
grep Flowchart
352
1
grep Operation Example
352
2
grep Family
354
5
grep
355
1
Fast grep
356
1
Extended grep
356
3
Examples
359
3
Searching for File Content
362
2
Search a Specific Directory
362
1
Search All Directories in a Path
363
1
Key Terms
364
1
Tips
364
1
Commands
365
1
Summary
365
1
Practice Set
366
2
Review Questions
366
1
Exercises
366
2
Lab Sessions
368
5
sed
373
52
Scripts
373
2
Script Formats
374
1
Instruction Format
374
1
Comments
374
1
Operation
375
2
Addresses
377
4
Single-Line Addresses
378
1
Set-of-Line Addresses
379
1
Range Addresses
380
1
Nested Addresses
381
1
Commands
381
25
Line Number Command
381
1
Modify Commands
382
4
Substitute Command (s)
386
5
Substitute Flags
391
2
Transform Command (y)
393
1
Input and Output Commands
394
5
File Commands
399
2
Branch Commands
401
3
Hold Space Commands
404
1
Quit
405
1
Applications
406
3
Delete Lines
406
2
Delete Text
408
1
grep and sed
409
2
Lines That Match a Regular Expression
409
1
Lines That Do Not Match a Regular Expression
410
1
Key Terms
411
1
Tips
411
1
Commands
412
1
Summary
413
1
Practice Set
414
7
Review Questions
414
2
Exercises
416
5
Lab Sessions
421
4
awk
425
74
Execution
425
1
Fields and Records
426
2
Buffers and Variables
426
1
Variables
427
1
Scripts
428
1
Initialization Processing (BEGIN)
428
1
Body Processing
429
1
End Processing (END)
429
1
Operation
429
2
Patterns
431
7
Simple Patterns
432
4
Nothing (No Pattern)
436
1
Range Patterns
436
2
Actions
438
15
Expression Statement
439
1
Output Statements
440
4
Decision Statements
444
2
Control Actions
446
3
Loops
449
4
Associative Arrays
453
6
Processing Arrays
454
5
Delete Array Entry
459
1
String Functions
459
8
Length
460
1
Index
460
1
Substring
461
2
Split
463
1
Substitution
464
1
Global Substitution
465
1
Match
466
1
Toupper and Tolower
466
1
Mathematical Functions
467
1
User-Defined Functions
468
1
Using System Commands in awk
469
3
Using Pipes
469
2
Using the System Function
471
1
Applications
472
3
Phone List
472
1
Count Lines and Words
473
1
Print Line Following a Blank Line
473
1
Print Line Before a Blank Line
474
1
Merge Files
474
1
awk and grep
475
2
Find the Line That Matches a Regular Expression
475
1
Find the Line That Does Not Match a Regular Expression
476
1
sed and awk
477
4
Print Line Numbers
477
1
Modify a Line
478
1
Substitute
479
1
Transform
479
1
Input/Output
480
1
Files
480
1
Branch
480
1
Quit
480
1
Key Terms
481
1
Tips
481
1
Commands
482
1
Summary
483
1
Practice Set
484
4
Review Questions
484
2
Exercises
486
2
Lab Sessions
488
11
PART II
Interactive Korn Shell
499
48
Korn Shell Features
499
3
Korn Shell Sessions
499
1
Standard Streams
499
1
Redirection
499
1
Pipes
500
1
tee Command
500
1
Combining Commands
501
1
Command-Line Editing
501
1
Quotes
501
1
Command Substitution
501
1
Job Control
501
1
Aliases
502
1
Two Special Files
502
2
Trash File (/dev/null)
502
1
Terminal File (/dev/tty)
503
1
Variables
504
10
User-Defined Variables
504
1
Predefined Variables
505
1
Storing Values in Variables
505
1
Accessing the Value of a Variable
506
1
Null Variables
507
1
Unsetting a Variable
508
1
Storing Filenames
508
1
Storing File Contents
508
1
Storing Commands in a Variable
509
1
Read-Only Variables
509
1
Exporting Variables
510
2
Variable Attribute: The typeset Command
512
2
Output
514
2
Input
516
2
Reading Word by Word
517
1
Reading Line by Line
517
1
Reading from a File
518
1
Exit Status of a Command
518
1
eval Command
519
2
Environmental Variables
521
7
Change Directory Path (CDPATH)
522
1
History File Path (HISTFILE)
522
1
Home Path (HOME)
523
1
Login Name (LOGNAME)
523
1
Mailbox Pathname (MAIL)
523
1
Mail Check Interval (MAILCHECK)
524
1
Incoming Mail Paths (MAILPATH)
524
1
Directory Search Paths (PATH)
524
1
Primary Prompt (PSI)
524
2
Secondary Prompt (PS2)
526
1
Third Prompt (PS3)
526
1
Fourth Prompt (PS4)
526
1
User Input Default Variable (REPLY)
526
1
Login Shell Path (SHELL)
527
1
Terminal Description (TERM)
527
1
Handling Environmental Variables
527
1
Options
528
2
Export All (allexport)
528
1
Command-Line Editor (emacs and vi)
528
1
Ignore End-of File (ignoreeof)
529
1
No Clobber in Redirection (noclobber)
529
1
No Execute (noexec)
529
1
No Global (noglob)
529
1
Verbosity (verbose)
529
1
Execute Trace (xtrace)
530
1
Handling Options
530
1
Startup Scripts
530
2
System Profile File
530
1
Personal Profile File
531
1
Environment File
531
1
Startup Process
532
1
Command History
532
4
History File
532
1
History Command
533
2
Redo Command (r)
535
1
Substitution in Redo Command
536
1
Command Execution Process
536
1
Execution Steps
536
1
Command Execution Example
537
1
Key Terms
537
1
Tips
538
1
Commands
539
1
Summary
540
1
Practice Set
541
3
Review Questions
541
1
Exercises
542
2
Lab Sessions
544
3
Korn Shell Programming
547
70
Basic Script Concepts
547
8
Script Components
547
2
Making Scripts Executable
549
1
Executing the Script
549
4
Script Termination (exit Command)
553
1
Arguments and Positional Parameters
554
1
Expressions
555
7
Mathematical Expressions
556
1
Relational Expressions
557
2
File Expressions
559
1
Logical Expressions
560
2
Expression Type Summary
562
1
Decisions: Making Selections
562
9
if-then-else
562
5
Multiway Selection
567
4
Repetition
571
14
Command-Controlled and List-Controlled Loops
571
9
Background Loops
580
1
Loop Redirection
580
5
Special Parameters and Variables
585
4
Special Parameters
585
3
Special Variables
588
1
Special Parameter and Variable Summary
588
1
Changing Positional Parameters
589
4
shift Command
591
2
Argument Validation
593
4
Number of Arguments Validation
593
1
Type of Argument Validation
594
3
Debugging Scripts
597
4
Debug Options Included in the Script
597
1
Debug Options on the Command Line
598
3
Script Examples
601
3
Cat
601
2
Copy
603
1
Key Terms
604
1
Tips
605
1
Commands
605
2
Summary
607
1
Practice Set
608
5
Review Questions
608
1
Exercises
609
4
Lab Sessions
613
4
Korn Shell Advanced Programming
617
54
Variable Evaluation and Substitution
617
5
Variable Evaluation
617
1
Variable Substitution
618
4
String Manipulation
622
6
Compress Strings
622
1
String Length
623
1
Locating a Substring in a String
624
1
Extract Substring
625
1
Stripping Strings
626
1
Using Other Utilities
627
1
Here Document
628
1
Functions
629
6
Writing Functions
629
2
Returning Values
631
1
Comparing Strings
632
1
Functions in Files
633
2
Arrays
635
1
Signals
636
3
Signal Types
636
1
Response to Signals
637
1
trap Command
638
1
Built-in Commands
639
2
Sleep Command
640
1
Dot Command
641
1
Scripting Techniques
641
14
Reading Strings
641
1
User Interaction
642
2
Parsing Options
644
4
Parsing Pathnames
648
3
Opening and Closing Files
651
4
Shell Environment and Script
655
1
Script Examples
656
5
Calculate
656
2
Reverse
658
1
Add Column
659
2
Key Terms
661
1
Tips
661
1
Commands
662
1
Summary
663
1
Practice Set
664
2
Review Questions
664
1
Exercises
665
1
Lab Sessions
666
5
Interactive C Shell
671
44
C Shell Features
671
5
C Shell Sessions
671
1
Standard Streams
671
1
Redirection
671
1
Pipes
672
1
tee Command
672
1
Combining Commands
673
1
Command-Line Editing
673
1
Quotes
673
1
Command Substitution
673
1
Job Control
674
1
Aliases in the C Shell
674
2
Two Special Files
676
3
Trash File (/dev/null)
676
1
Terminal File (/dev/tty)
677
2
Variables
679
7
User-Defined Variables
679
1
Predefined Variables
679
1
Storing Values in Variables
680
1
Accessing the Value of a Variable
681
1
Null Variables
681
1
Unsetting a Variable
682
1
Storing Filenames
682
1
Storing File Contents
683
1
Storing Commands in a Variable
683
1
Exporting Variables
684
2
Output
686
2
Input
688
1
Reading Line by Line
688
1
Reading Word by Word
688
1
Exit Status of a Command
688
1
eval Command
689
1
Environmental Variables
690
5
Handling Environmental Variables
694
1
On-Off Variables
695
2
Handling On-Off Variables
697
1
Startup and Shutdown Scripts
697
2
System Startup Files
698
1
Personal Startup Files
698
1
Startup Process
698
1
Shutdown Files
698
1
Command History
699
5
History File
699
1
History Command
699
1
Reexecuting Previous Commands
700
1
Substitute and Reexecute
701
1
Using Arguments from Previous Command
702
1
History Modifier
702
1
Pathname Modifier
703
1
History Command Summary
703
1
Command Execution Scripts
704
2
Execution Steps
704
1
Command Execution Example
705
1
Key Terms
706
1
Tips
706
1
Commands
707
1
Summary
707
2
Practice Set
709
2
Review Questions
709
1
Exercises
710
1
Lab Sessions
711
4
C Shell Programming
715
54
Basic Script Concepts
715
8
Script Components
715
2
Making Scripts Executable
717
1
Executing the Script
717
4
Script Termination (exit Command)
721
1
Arguments and Positional Parameters
722
1
Expressions
723
5
Mathematical Expressions
724
1
Relational Expressions
725
1
File Expressions
726
1
Logical Expressions
727
1
Decisions: Making Selections
728
8
if then-else
728
4
Multiway Selection
732
4
Repetition
736
6
C Shell Loops
736
6
Special Parameters
742
2
Script Name ($0)
743
1
Number of Arguments ($#argv)
743
1
All Parameters ($argv)
743
1
Special Parameter Summary
744
1
Changing Positional Parameters
744
3
shift Command
746
1
Argument Validation
747
5
Number of Arguments Validation
748
1
Type of Argument Validation
749
3
Debugging Scripts
752
4
Debug Options Included in the Script
752
1
Debug Options on the Command Line
753
3
Script Examples
756
2
Copy
756
2
Key Terms
758
1
Tips
758
1
Commands
759
1
Summary
760
1
Practice Set
761
3
Review Questions
761
1
Exercises
761
3
Lab Sessions
764
5
C Shell Advanced Programming
769
30
Variable Evaluation
769
1
String Manipulation
769
3
Compress Strings
770
1
Using Other Utilities
771
1
Here Document
772
1
Signals
773
2
Signal Types
773
1
Response to Signals
774
1
On Interrupt Command
774
1
Built-in Commands
775
2
Sleep Command
776
1
Source Command
777
1
Scripting Techniques
777
3
Reading Strings
778
1
User Interaction
778
1
Parsing Pathnames
779
1
Shell Environment and Script
780
1
Arrays
781
3
Creating an Array
782
1
Parsing Input
783
1
Script Examples
784
6
Simulate find Command
784
2
General Ledger System
786
3
Eliminate Duplicates
789
1
Key Terms
790
1
Tips
790
1
Commands
791
1
Summary
791
1
Practice Set
792
1
Review Questions
792
1
Exercises
792
1
Lab Sessions
793
6
Appendix A ASCII Table
799
5
Appendix B A Short History
804
3
B.1 The Early Years
804
1
B.2 The Modern Era
804
1
B.3 Descendants of System V and BSD4
805
1
B.4 POSIX
806
1
Appendix C emacs
807
14
C.1 Loading the File
807
2
C.2 Editing the Text
809
7
C.3 Saving and Leaving emacs
816
1
C.4 Miscellaneous Command
817
4
Appendix D Numbering Systems
821
5
D.1 Computer Numbering Systems
821
3
D.2 Integer Transformations
824
2
Appendix E Predefined Variables
826
2
Appendix F UNIX Commands
828
8
Appendix G Shell Metacharacters
836
1
Appendix H Korn and C Shell Differences
837
7
H.1 Variables
837
1
H.2 Command-Line Editing
837
1
H.3 Command Substitution
838
1
H.4 Aliases
838
1
H.5 Input/Output
838
1
H.6 Environmental Variables
839
1
H.7 Startup Files
839
1
H.8 Shutdown Files
839
1
H.9 Options and On-Off Variables
840
1
H.10 History
840
1
H.11 Parameters
840
1
H.12 Special Variables
841
1
H.13 Expressions
841
1
H.14 Selection
841
1
H.15 Repetition
842
1
H.16 Arrays
843
1
H.17 Functions
843
1
Glossary
844
<