وبلاگ بلیان

UNIX and Shell Programming

معرفی کتاب «UNIX and Shell Programming» نوشتهٔ Harwani, B. M، منتشرشده توسط نشر IRL Press at Oxford University Press در سال 2013. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «UNIX and Shell Programming» در دستهٔ بدون دسته‌بندی قرار دارد.

Beginning with the description of operating system in general the book discusses features that made Unix the most suitable operating system of its time. An overview of file management in Unix and commonly used Unix commands is then provided. Further, it delves into the detailed description of file system and compression techniques, processes and signals, vi editor, system calls, and awk scripting. Detailed description about different types of editors and shell programming (including Bourne, C, and interactive Korn shell) has also been provided. Chapters dedicated to debugging and system development, language development, text formatting tools, interprocess communication, and system administration are covered in the later part of the book. To aid students, the book provides numerous examples and complete program scripts that will help in grasping the key concepts effectively. Front Matter 1 Dedication 3 Preface 4 Table of Contents 8 1. Unix: An Introduction 17 1.1 Operating System 17 1.1.1 Functions of Operating Systems 18 1.2 History of Unix 19 1.3 Overview and Features of Unix System 20 1.3.1 Multitasking 20 1.3.2 Multi-User 21 1.3.3 Portability 21 1.3.4 Job Control 21 1.3.5 Tools and Utilities 21 1.3.6 Security 22 1.4 Structure of Unix System 22 1.4.1 Hardware 22 1.4.2 Kernel 23 1.4.3 Shell 24 1.4.3.1 Types of Shells 24 1.4.4 Tools and Applications 25 1.5 Unix Environment 25 1.5.1 Stand-Alone Personal Environment 26 1.5.2 Time-Sharing Environment 26 1.5.3 Client-Server Environment 26 Summary 26 Exercises 27 Answers to Objective-Type Questions 28 2. Unix File System 29 2.1 Introduction to Files 29 2.1.1 Types of Files 29 2.1.1.1 Ordinary Files 29 2.1.1.2 Directory Files 30 2.1.1.3 Device Files 30 2.1.2 Symbolic Links 31 2.1.3 Pipes 31 2.1.4 Sockets 32 2.2 Organization of File Systems 32 2.3 Accessing File Systems 33 2.3.1 Mounting File Systems 34 2.3.2 Unmounting File Systems 34 2.4 Structure of File Systems 36 2.4.1 Boot Block 36 2.4.2 Super Block 36 2.4.3 Inode Block 37 2.4.3.1 Directory 38 2.4.4 Data Block 40 Summary 40 Exercises 41 Answers to Objective-Type Questions 42 3. Basic Unix Commands 43 3.1 login: Logging in to Systems 43 3.2 Overview of Commands 44 3.2.1 Structure 45 3.2.2 Types of Commands in Unix 45 3.2.2.1 passwd: Changing Password 45 3.2.2.2 ls: Listing Files and Directories 46 3.2.2.3 mkdir: Making Directories 48 3.2.2.4 cd: Changing Directories 50 3.2.2.5 rmdir: Removing Directories 51 3.2.2.6 pwd: Print Working Directory 51 3.2.2.7 uname: Displaying Information about Current System 52 3.2.2.8 touch: Creating Files and Changing Time Stamps 53 3.2.2.9 cat: Showing, Creating, and Concatenating Files 53 3.2.2.10 cp: Copying Files 55 3.2.2.11 mv: Renaming Files 56 3.2.2.12 rm: Removing Files 57 3.2.2.13 ln: Linking Files 58 3.2.2.14 unlink: Deleting Symbolic Links 60 3.2.2.15 tput: Exploiting Terminal Capabilities 60 3.2.2.16 who: Who is Online 61 3.2.2.17 finger: Online User's Details 62 3.2.2.18 date: Displaying System Date and Time 64 3.2.2.19 cal: Displaying Calendar 64 3.2.2.20 echo: Displaying Messages and Results 65 3.2.2.21 bc: Basic Calculator 65 3.2.2.22 Filename Substitution - Globbing 68 3.2.2.23 exit: Exiting 70 Summary 70 Function Specification 70 Exercises 71 Answers to Objective-Type Questions 74 4. Advanced Unix Commands 75 4.1 Overview 75 4.2 File Access Permissions 76 4.2.1 chmod: Changing File Access Permissions 77 4.2.2 umask: Setting Default Permissions 78 4.2.3 chown: Changing File Ownership 80 4.2.4 chgrp: Changing Group Command 81 4.2.5 groups: Displaying Group Membership 82 4.2.6 groups: Sharing Files among Groups 82 4.3 Input/Output Redirection in Unix 83 4.3.1 Output Redirection Operator 83 4.3.2 Input Redirection Operator 84 4.4 Pipe Operator 84 4.5 cut: Cutting Data from Files 84 4.6 paste: Pasting Data in Files 87 4.7 split: Splitting Files into Lines or Bytes 87 4.8 wc: Counting Characters, Words, and Lines in Files 89 4.9 sort: Sorting Files 89 4.10 head: Displaying Top Contents of Files 90 4.11 tail: Displaying Bottom Contents of Files 91 4.12 diff: Finding Differences between Two Files 91 4.13 cmp: Comparing Files 93 4.14 uniq: Eliminating and Displaying Duplicate Lines 94 4.15 comm: Displaying and Suppressing Unique or Common Content in Two Files 95 4.16 time: Finding Consumed Time 97 4.17 pg: Showing Content Page-Wise 98 4.18 lp: Printing Documents 98 4.19 cancel: Cancelling Print Command 100 4.20 Understanding .profile Files 100 4.21 calendar: Getting Reminders 101 4.22 script: Recording Sessions 101 4.23 Conversions between DOS and Unix 102 4.24 man: Displaying Manual 103 4.25 Correcting Typing Mistakes 104 Summary 105 Function Specification 105 Exercises 106 Answers to Objective-Type Questions 109 5. File Management and Compression Techniques 110 5.1 Managing and Compressing Files 110 5.2 Computer Devices 111 5.2.1 Dealing with Devices 112 5.2.2 Block Device 113 5.2.3 Major and Minor Numbers 114 5.3 Disk-Related Commands 114 5.3.1 dd: Copying Disks 115 5.3.2 du: Disk Usage 115 5.3.3 df: Reporting Free and Available Space on File Systems 117 5.3.4 dfspace: Reporting Free Space on File Systems 119 5.3.5 fdisk: Dividing Disks into Partitions 119 5.4 Compressing and Uncompressing Files 121 5.4.1 gzip Command 121 5.4.2 gunzip Command 123 5.4.3 zip Command 125 5.4.4 unzip Command 127 5.4.5 compress Command 127 5.4.6 uncompress Command 130 5.4.7 pack Command 131 5.4.8 unpack Command 131 5.4.9 bzip2 and bunzip2 Commands 133 5.4.10 bunzip2 Command 135 5.4.11 7-zip - Implementing Maximum Compression 135 5.5 Dealing with Files 139 5.5.1 file: Determining File Type 140 5.5.2 find: Locating Files 140 5.5.2.1 Using find Operators 143 5.5.3 locate: Searching for Files with Specific Strings 145 5.5.4 which/whence: Finding Locations of Programs or Utilities on Disks 146 5.5.5 fsck: Utility for Checking File Systems 146 5.6 Important Unix System Files 151 5.6.1 /etc/passwd 151 5.6.2 /etc/shadow 152 5.6.3 /etc/hosts 152 5.6.4 /etc/hosts.allow and /etc/hosts.deny 153 5.7 Shell Variables 154 5.7.1 User-Created Shell Variables 154 5.7.2 System Shell Variables 154 5.7.2.1 CDPATH Variable 155 5.7.2.2 HOME Variable 156 5.7.2.3 PATH Variable 156 5.7.2.4 Primary prompt Variable 156 5.7.2.5 SHELL Variable 157 5.7.2.6 TERM Variable 157 5.7.2.7 Setting/Unsetting System Shell Variables 157 5.8 Export of Local and Global Shell Variables 157 Summary 159 Function Specification 160 Exercises 160 Answers to Objective-Type Questions 163 6. Manipulating Processes and Signals 164 6.1 Process Basics 164 6.1.1 Process Address Space 167 6.1.2 Process Structure 167 6.1.2.1 Process Table 167 6.1.2.2 User Area 168 6.1.2.3 Per Process Region Table 169 6.1.2.4 Region Table 169 6.1.3 Creation and Termination of Processes 170 6.2 Process States and Transitions 170 6.3 Zombie Process 172 6.4 Context Switching 173 6.5 Threads 174 6.5.1 Comparison between Threads and Processes 174 6.6 ps: Status of Processes 175 6.7 Handling Jobs 177 6.7.1 fg: Foreground Jobs 178 6.7.1.1 Suspending, Resuming, and Terminating Foreground Jobs 178 6.7.2 bg: Background Jobs 178 6.7.2.1 Suspending, Resuming, and Terminating Background Jobs 179 6.7.3 Switching Jobs from Background to Foreground and Vice Versa 180 6.7.4 jobs: Showing Job Status 180 6.8 Scheduling of Processes 181 6.8.1 cron: Chronograph - Time-Based Job Scheduler 182 6.8.2 crontab: Creating Crontab Files 182 6.8.3 at: Scheduling Commands at Specific Dates and Times 183 6.8.4 batch: Executing Commands Collectively 186 6.8.5 nohup: No Hangups 186 6.8.6 nice: Modifying Priority 187 6.8.7 kill: Killing Processes 188 6.9 Signals 189 6.9.1 Classes of Signals 191 6.9.1.1 Reliable Signals 191 6.9.1.2 Unreliable Signals 192 6.9.2 Sending Signals Using kill and raise 192 6.9.3 Signal Handling Using signal 193 6.9.3.1 Compiling C Programs 194 6.9.3.2 alarm and pause Functions 197 6.9.3.3 abort Function 197 6.9.3.4 sleep Function 197 6.10 Virtual Memory 199 6.10.1 Paging 200 6.10.2 Demand Paging 200 6.10.2.1 vmstat: Fetching Virtual Memory Information 201 6.10.3 Segmentation 202 6.10.4 Memory-Mapped Input/Output 203 Summary 203 Function Specification 204 Exercises 204 Answers to Objective-Type Questions 207 7. System Calls 208 7.1 Introduction 208 7.1.1 Operation Modes 208 7.1.2 Kernel Mode 209 7.1.3 User Mode 209 7.2 File-Related System Calls 210 7.2.1 open: Opening Files 211 7.2.2 create: Creating Files 212 7.2.3 read: Reading from Files 212 7.2.4 write: Writing to Files 213 7.2.5 lseek: Relocating File Descriptors 215 7.2.6 close: Closing Files 216 7.2.7 mknod: Creating Files 217 7.2.8 dup and dup2: Duplicating File Descriptors 218 7.2.9 link and symlink: Linking to Files 219 7.2.10 unlink: Unlinking Files 221 7.2.11 stat, fstat, and lstat: Accessing File Status Information 221 7.2.12 access: Checking Permissions 223 7.2.13 chown, lchown, and fchown: Changing Owner and Group of Files 224 7.2.14 chmod and fchmod: Changing Permissions of Files 226 7.2.15 umask: Setting File Mode Creation Mask 227 7.2.16 utime: Changing Access and Modification Times 227 7.2.17 ioctl: Controlling Devices 228 7.3 Directory Handling System Calls 229 7.3.1 mkdir and rmdir: Creating and Removing Directories 230 7.3.2 chdir: Changing Directories 231 7.3.3 getcwd: Determining Current Working Directory 232 7.3.4 opendir: Opening Directories 233 7.3.5 readdir: Reading Directories 233 7.3.6 telldir, seekdir, and rewinddir: Knowing, Setting, and Resetting Position in Directory Streams 236 7.3.6.1 Knowing Our Position in Directory Streams 236 7.3.6.2 Setting Position in Directory Streams 236 7.3.6.3 Resetting Position in Directory Streams 237 7.3.7 closedir: Closing Directory Streams 238 7.4 Process-Related System Calls 239 7.4.1 exec: Replacing Executable Binaries with New Processes 239 7.4.2 fork: Creating New Processes 241 7.4.2.1 vfork: Creating New Processes Suspending Parent Processes 242 7.4.3 wait: Waiting 242 7.4.4 exit: Terminating Processes 243 7.5 Interrupted System Call 244 7.6 Standard C Library Functions 246 7.6.1 Difference between System Calls and Library Functions 246 7.6.1.1 System Calls 246 7.6.1.2 C Library Functions 247 7.7 Streams and File Input/Output Library Functions 247 7.7.1 fopen: Opening Files 248 7.7.2 fwrite: Writing into Files 248 7.7.3 fread: Reading Data from Files 249 7.7.4 fclose: Closing Files 250 7.7.5 fflush: Flushing Out to Files 250 7.7.6 fseek: Relocating File Pointers 250 7.7.7 fgetc, getc, and getchar: Reading Characters 251 7.7.7.1 Writing Characters 251 7.7.8 fgets and gets: Reading Strings 252 7.8 Error Handling 254 7.8.1 Using strerror Function 255 7.8.2 perror: Displaying Errors 255 7.9 Stream Errors 257 7.10 Functions for Dynamic Memory Management 258 7.10.1 malloc: Allocating Memory Block 258 7.10.2 calloc: Allocating Arrays of Memory Blocks 259 7.10.3 realloc: Resizing Allocated Memory 259 7.10.4 free: Freeing Allocated Memory 259 7.11 File Locking 261 7.11.1 Creating Lock Files 261 7.11.2 Record Locking 263 7.11.2.1 F_GETLK Command 264 7.11.2.2 F_SETLK Command 264 7.11.2.3 F_SETLKW Command 264 7.11.2.4 Types of Locks 264 7.11.3 Competing Locks 265 7.11.4 Deadlock 268 Summary 269 Exercises 271 Answers to Objective-Type Questions 273 8. Editors in Unix 274 8.1 Introduction 274 8.2 Stream Editor 275 8.2.1 Actions with Sed 276 8.2.1.1 Adding Text 279 8.2.1.2 Substitution 281 8.2.1.3 Context Addressing 283 8.2.1.4 Regular Expression 283 8.2.2 Remembered Patterns 285 8.3 Visual Editor 286 8.3.1 Creating and Editing Files 287 8.3.2 Inserting and Appending Text 287 8.3.3 Replacing Text 288 8.3.4 Inserting and Joining Lines 289 8.3.5 Exiting and Writing to Files 289 8.3.6 Navigating - Line Positioning and Cursor Positioning 290 8.3.7 Positioning Cursor on Words 291 8.3.8 Positioning Cursor on Sentences 291 8.3.9 Positioning Cursor on Paragraphs 292 8.3.10 Scrolling through Text 292 8.3.11 Marking Text 292 8.3.12 Deleting and Undoing Text 293 8.3.13 Repeating Previous Commands 294 8.3.14 Going to Specified Lines 294 8.3.15 Searching for and Repeating Search Patterns 294 8.3.16 Searching for Characters 295 8.3.17 Copying, Changing, Pasting, and Filtering Commands 296 8.3.18 Set Commands 296 8.3.19 Reading and Writing across Files 299 8.3.20 Global Substitution - Find and Replace 301 8.3.21 Ex Mode - Line Editor Mode 303 8.3.22 Abbreviating Text Input 310 8.3.23 Mapping Keys of Keyboard 311 8.3.24 Customizing vi Session 311 8.3.24.1 Advantages of vi 312 8.4 Emacs Editor 312 8.4.1 Cursor Movements 313 8.4.2 Quitting Emacs 313 8.4.3 Dealing with Buffers 314 8.4.4 Cutting and Pasting 314 8.4.5 Searching and Replacing 314 8.4.6 Miscellaneous Commands 315 Summary 316 Exercises 317 Answers to Objective-Type Questions 320 9. AWK Script 321 9.1 AWK Command 321 9.1.1 Versions 321 9.1.2 Advantages and Disadvantages of Using AWK Filters 322 9.2 print: Printing Results 323 9.3 printf: Formatting Output 324 9.4 Displaying Content of Specified Patterns 324 9.5 Comparison Operators 325 9.5.1 ~ and !~: Matching Regular Expressions 326 9.6 Compound Expressions 328 9.7 Arithmetic Operators 331 9.8 Begin and End Sections 331 9.9 User-Defined Variables 332 9.10 if else Statement 334 9.11 Built-in Variables 337 9.11.1 fs: Field Separator 338 9.11.2 OFS: Output Field Separator 338 9.12 Changing Input Field Separator 339 9.13 Functions 340 9.13.1 String Functions 341 9.13.2 Arithmetic Functions 350 9.14 Loops 353 9.14.1 for Loop 353 9.14.2 do while Loop 357 9.14.3 while Loop 358 9.15 Getting Input from User 359 9.15.1 getline Command: Reading Input 359 9.16 Search and Substitute Functions 361 9.16.1 sub 361 9.16.2 gsub 363 9.16.3 match 364 9.16.4 toupper 365 9.16.5 tolower 365 9.17 Copying Results into Another File 377 9.18 Deleting Content from Files 379 9.19 Arrays 380 9.20 Associative Arrays 382 Summary 388 Exercises 389 Answers to Objective-Type Questions 393 10. Bourne Shell Programming 394 10.1 Introduction 394 10.2 Beginning Bourne Shell Scripting 395 10.2.1 echo: Displaying Messages and Values 395 10.2.2 Variables 396 10.2.3 expr: Evaluating Expressions 396 10.2.4 let: Assigning and Evaluating Expressions 397 10.2.5 bc: Base Conversion 397 10.2.6 factor: Factorizing Numbers 398 10.2.7 units: Scale Conversion 399 10.3 Writing Shell Scripts 399 10.4 Command Line Parameters 401 10.5 read: Reading Input from Users 401 10.6 for Loop 402 10.7 while Loop 406 10.8 until Loop 408 10.9 if Statement 409 10.10 Bourne Shell Commands 410 10.10.1 test: Testing Expressions for Validity 411 10.10.2 [ ]: Test Command 413 10.10.3 tr: Applying Translation 416 10.10.3.1 Deleting Matching Characters 416 10.10.4 wc: Counting Lines, Words, and Characters 419 10.10.5 grep: Searching Patterns 420 10.10.6 egrep: Searching Extended Regular Expressions 425 10.10.7 Command Substitution 427 10.10.8 cut: Slicing Input 428 10.10.9 paste: Pasting Content 429 10.10.10 sort: Sorting Input 431 10.10.11 uniq: Eliminating and Displaying Duplicate Lines 437 10.10.12 /dev/null: Suppressing Echo 438 10.10.13 Logical Operators 442 10.10.13.1 && - And Operator 443 10.10.13.2 || - Or Operator 443 10.10.13.3 ! - Not Operator 443 10.10.14 exec: Execute Command 445 10.10.14.1 Closing Files 446 10.10.15 sleep: Suspending Execution 450 10.10.16 exit: Terminating Programs 451 10.10.17 $?: Observing Exit Status 452 10.10.18 tty: Terminal Command 457 10.10.19 write: Sending and Receiving Messages 458 10.10.20 mesg: Controlling Delivery of Messages 459 10.10.21 wall: Broadcasting Message 460 10.10.22 stty: Setting and Configuring Terminals 460 10.10.23 w;who: Activities of Logged in User 465 10.10.24 last: Listing Last Logged 465 10.10.25 case Statement 467 10.10.26 Functions 471 10.10.27 select: Creating Menus 473 10.10.28 basename: Extracting Base Filename 476 10.10.29 expr - Advanced Features 478 10.10.30 getopts: Handling Options in Command Line 480 10.10.30.1 Options with No Values 480 10.10.30.2 Options with Values 481 10.10.31 set: Setting Positional Parameters 483 10.10.32 shift: Shifting Command Line Arguments 484 10.10.33 at: Scheduling Execution 485 10.11 Trapping Signals 486 Summary 487 Exercises 489 Answers to Objective-Type Questions 495 11. Korn Shell Programming 496 11.1 Introduction 496 11.2 Features 496 11.2.1 Command Line Editing 497 11.2.1.1 Using vi 497 11.2.1.2 Using emacs 498 11.2.2 Filename Completion 499 11.2.3 Command Name Aliasing 499 11.2.4 Command History Substitution 500 11.2.4.1 Retrieving Commands from Command History in Korn Shell 500 11.3 Korn Shell Meta Characters 500 11.4 Operators 501 11.4.1 Arithmetic and Logical Operators 501 11.4.2 Relational Operators 502 11.5 Variables 502 11.5.1 Shell Variables 502 11.5.1.1 Creating Shell Variables 502 11.5.1.2 Assigning Values to Shell Variables 503 11.5.1.3 Exporting Variables 503 11.5.2 Environment Variables 503 11.6 Setting Shell Prompts 507 11.6.1 PS1 Variable 508 11.6.2 PS2 Variable 509 11.6.3 PS3 Variable 509 11.6.3.1 select Command 509 11.6.4 PS4 Variable 511 11.7 Setting Display Environment Variable 512 11.7.1 Terminal 512 11.7.2 Display 513 11.8 Steps to Create and Run Korn Shell Scripts 513 11.9 Basic Input/Output Commands 515 11.9.1 echo 515 11.9.2 print 516 11.9.3 read 516 11.9.4 printf 517 11.9.5 typeset 518 11.9.6 Converting Base 10 to Octal 519 11.9.7 unset 520 11.10 Variable Substitution 521 11.11 Command Line Arguments 522 11.11.1 shift: Shifting Positional Parameters 524 11.11.2 set: Handling Positional Parameters 525 11.11.3 test Command 526 11.12 Pattern-Matching Operators 527 11.12.1 if else Statement 527 11.13 Testing Strings 529 11.14 case...esac Statement 537 11.15 while Loop 540 11.16 break: Breaking Out of Loops 542 11.17 continue: Skipping Statements in Loops 543 11.18 until Loop 545 11.19 for Loop 546 11.20 Arrays 553 11.20.1 Indexed Array 554 11.20.2 Associative Array 555 11.21 Functions 556 11.21.1 return Command 557 11.21.2 Passing Arguments to Functions 558 11.21.3 Creating Local Variables 559 11.21.4 Recursion 560 11.22 exit 562 11.23 $? 562 11.24 Input/Output Redirection 563 Summary 567 Exercises 569 Answers to Objective-Type Questions 573 12. C Shell Programming 574 12.1 C Shell 574 12.1.1 Features 574 12.1.2 Command History 575 12.1.2.1 Retrieving Commands from History 575 12.1.3 Command Substitution 577 12.1.4 Filename Substitution - Globbing 577 12.1.5 Filename Completion 578 12.1.6 Aliases 579 12.1.7 Job Control 580 12.2 Start-up Files 581 12.2.1 .cshrc File 582 12.2.2 .login File 582 12.2.3 .logout File 583 12.3 Variables 583 12.3.1 Environment Variables 583 12.3.2 Shell Variables 585 12.3.3 Built-in Shell Variables 585 12.3.4 Unsetting Variable 586 12.4 Customizing Shells 587 12.4.1 Setting Primary Prompt 587 12.4.2 Changing History Characters 588 12.4.3 Setting mail Variable 588 12.4.3.1 Sending Mail 589 12.5 C Shell Operators 589 12.6 Writing and Executing First C Shell Script 592 12.6.1 Reading Data 594 12.6.2 User-Defined Shell Variables 595 12.7 Flow Controlling Statements 598 12.7.1 if-then-else Statements 598 12.7.1.1 File Testing Operators 598 12.7.1.2 $? Variable 600 12.7.2 Branching with goto 607 12.7.3 exit Command 609 12.7.4 switch, case, breaksw, and endsw Statements 611 12.8 Loops 615 12.8.1 while end Loop 615 12.8.2 repeat Command 618 12.8.3 foreach end Loop 620 12.8.3.1 continue Statement 621 12.8.3.2 break Statement 621 12.9 Arrays 628 12.10 Displaying Errors 633 Summary 635 Exercises 637 Answers to Objective-Type Questions 639 13. Different Tools and Debuggers 640 13.1 Language Development Tools - Yacc, Lex, and m4 640 13.1.1 Yet Another Compiler-Compiler 640 13.1.2 Lexical Analyser 641 13.1.3 m4 642 13.1.3.1 Creating Macros 642 13.2 Text-Formatting Tools 644 13.2.1 troff 644 13.2.2 nroff 645 13.3 Preprocessors for nroff and troff 646 13.3.1 tbl 646 13.3.1.1 Options Used with tbl 647 13.3.1.2 Formats Used with tbl 648 13.3.2 eqn 649 13.3.2.1 Keywords Recognized by eqn 650 13.3.3 pic 651 13.3.3.1 pic Macros 651 13.3.3.2 Options 652 13.3.4 Commands Used in pic 654 13.3.4.1 Loops: Repeating Sets of Commands 654 13.3.4.2 Conditional Statement 654 13.3.4.3 Including Contents from Specified Files 654 13.3.4.4 Resetting Variables 655 13.4 Debugger Tools 655 13.4.1 dbx 656 13.4.1.1 Setting Breakpoints 657 13.4.1.2 Viewing Call Stacks 657 13.4.2 adb 657 13.4.3 sdb 658 13.4.3.1 Printing Stack Traces 660 13.4.3.2 Setting and Deleting Breakpoints 661 13.4.3.3 Ways of Deleting Breakpoints 661 13.4.3.4 Running Programs 662 13.5 strip: Discarding Symbols from Object Files 663 13.6 Version-Control Systems 664 13.6.1 Manual Version Control 664 13.6.2 Automated Version Control 664 13.6.2.1 Source Code Control System 665 13.6.2.2 Revision Control System 665 13.6.2.3 Concurrent Version System 665 Summary 665 Exercises 667 Answers to Objective-Type Questions 668 14. Interprocess Communication 669 14.1 Interprocess Communication 669 14.1.1 Pipes 670 14.1.2 Messages 670 14.1.3 Sockets 670 14.1.3.1 Creating Sockets 671 14.1.3.2 Binding Sockets to Addresses 672 14.1.3.3 Listening for Connections 672 14.1.3.4 Accepting Connections 673 14.1.3.5 Connecting to Sockets 673 14.1.4 Shared Memory 673 14.1.4.1 Accessing Shared Memory Segments 674 14.1.4.2 Attaching Segments to Address Space 674 14.1.4.3 Reading and Writing into Shared Memory Segments 675 14.1.4.4 Detaching Segments from Address Space 675 14.1.4.5 Altering Permissions of Memory Segments 676 14.2 Synchronization 677 14.2.1 Mutual Exclusion Locks 677 14.2.2 Semaphores 677 14.2.2.1 Initializing Semaphores 678 14.2.2.2 Managing Semaphores 678 14.2.2.3 Performing Operations on Semaphores 679 14.3 Input/Output Multiplexing 680 14.3.1 select System Call 680 14.3.2 pselect System Call 682 14.4 Filters 682 14.4.1 more Filter 683 14.4.2 less Filter 683 14.4.3 tee Command 684 Summary 685 Exercises 686 Answers to Objective-Type Questions 687 15. Unix System Administration and Networking 688 15.1 Unix Booting Procedure 688 15.1.1 Single-User Mode 688 15.1.2 Multi-User Mode 689 15.2 Mounting Unix File System 689 15.3 Unmounting Unix File System 690 15.4 Managing User Accounts 690 15.4.1 Creating User Accounts 690 15.4.2 Modifying User Accounts 692 15.4.3 Deleting User Accounts 692 15.4.4 Creating Groups 693 15.4.5 Modifying Groups 693 15.4.6 Deleting Groups 693 15.5 Networking Tools 694 15.5.1 ping 694 15.5.2 nslookup 694 15.5.3 telnet 695 15.5.4 arp 696 15.5.5 netstat 697 15.5.6 route 697 15.5.7 FTP 697 15.5.8 Trivial File Transfer Protocol 699 15.5.9 finger 699 15.5.10 rlogin 699 15.5.11 Unix Network Security 700 15.6 mail Command 701 15.6.1 Sending E-mails 701 15.6.2 Reading Mails 702 15.6.3 Sending Replies 703 15.6.4 Mail Commands 703 15.6.5 Saving Messages 704 15.6.6 Deleting Messages 704 15.6.7 Undeleting Messages 705 15.6.8 Quitting Mail Command 705 15.7 Distributed File System 705 15.7.1 Andrew File System 706 15.7.1.1 Features 706 15.7.1.2 Drawbacks 707 15.8 Firewalls 707 15.8.1 Advantages 708 15.8.2 Building Simple Firewalls 708 15.9 Backup and Restore 708 15.9.1 tar 709 15.9.2 cpio 709 15.9.3 dd 709 15.10 Shut Down and Restart 709 Summary 709 Exercises 710 Answers to Objective-Type Questions 711 Features of the Book 712 Index 714 A 714 B 714 C 716 D 717 E 719 F 720 G 723 I 723 J 724 K 724 L 725 M 726 N 726 O 727 P 727 R 728 S 729 T 732 U 733 V 733 W 734 Z 734 Beginning With The Description Of Operating System In General The Book Discusses Features That Made Unix The Most Suitable Operating System Of Its Time. An Overview Of File Management In Unix And Commonly Used Unix Commands Is Then Provided. Further, It Delves Into The Detailed Description Offile System And Compression Techniques, Processes And Signals, Vi Editor, System Calls, And Awk Scripting. Detailed Description About Different Types Of Editors And Shell Programming (including Bourne, C, And Interactive Korn Shell) Has Also Been Provided. Chapters Dedicated To Debugging And Systemdevelopment, Language Development, Text Formatting Tools, Interprocess Communication, And System Administration Are Covered In The Later Part Of The Book. To Aid Students, The Book Provides Numerous Examples And Complete Program Scripts That Will Help In Grasping The Key Concepts Effectively. Web Resources: For Studentsdt Chapter-wise Executable And Complete Shell Scripts And Codes Given In The Bookdt Mail Organizer - Project That Sends Mail To A Desired Recipient On A Given Date.dt Inventory Management System - Project That Explains Maintenance Of Inventory Using Mysql Database Server Dt Debugging Exercises With Solutions For Facultydt Chapter-wise Pptsdt Answers To Select Review Exercises Given In The Book From Fifa World Cup Champion, Olympic Gold Medalist, And Bestselling Author Alex Morgan Comes The Eighth Book In An Empowering And Fun-filled Middle Grade Series That Inspired The Amazon Original Series, The Kicks! Spring Season Continues And The Kicks Are Working Their Hardest To Be Champions. But Emma’s Confidence Takes A Dive After Tripping And Letting A Shot Go Into The Goal. Embarrassed By The Blunder, She’s Not Sure If She’s Cut Out To Be A Goalie. Devin Tries To Help Emma, But She’s Dealing With Uncertainties Of Her Own. The Cute New Boy At School Asks Jessi To Go To The Movies With Him And Some Other Friends, And She Accepts, Leaving Devin, Steven, And Cody Behind. Does Jessi Not Like Cody Anymore And What Does This Mean For Devin And Steven? With Everything So Uncertain, Will The Kicks Be Able To Stay In The Soccer Zone?
دانلود کتاب UNIX and Shell Programming