You are previewing Linux with Operating System Concepts.
O'Reilly logo
Linux with Operating System Concepts

Book Description

A True Textbook for an Introductory Course, System Administration Course, or a Combination Course

Linux with Operating System Concepts merges conceptual operating system (OS) and Unix/Linux topics into one cohesive textbook for undergraduate students. The book can be used for a one- or two-semester course on Linux or Unix. It is complete with review sections, problems, definitions, concepts, and relevant introductory material, such as binary and Boolean logic, OS kernels, and the role of the CPU and memory hierarchy.

Details for Introductory and Advanced Users

The book covers Linux from both the user and system administrator positions. From a user perspective, it emphasizes command line interaction. From a system administrator perspective, the text reinforces shell scripting with examples of administration scripts that support the automation of administrator tasks.

Thorough Coverage of Concepts and Linux Commands

The author incorporates OS concepts not found in most Linux/Unix textbooks, including kernels, file systems, storage devices, virtual memory, and process management. He also introduces computer science topics, such as computer networks and TCP/IP, binary numbers and Boolean logic, encryption, and the GNUs C compiler. In addition, the text discusses disaster recovery planning, booting, and Internet servers.

Table of Contents

  1. Preface
  2. Acknowledgments and Contributions
  3. How to Use This Textbook
  4. Author
  5. Chapter 1 - Introduction to Linux
    1. 1.1 Why Linux?
    2. 1.2 Operating Systems
    3. 1.3 The Linux Operating System: GUIs
      1. 1.3.1 User Account and Logging In
      2. 1.3.2 Gnome
      3. 1.3.3 KDE Desktop Environment
    4. 1.4 The Linux Command Line
      1. 1.4.1 The Interpreter
      2. 1.4.2 The Shell
      3. 1.4.3 The CLI over the GUI
    5. 1.5 Virtual Machines
    6. 1.6 Unix and Linux
    7. 1.7 Types of Users
    8. 1.8 What Is a Computer?
      1. 1.8.1 The IPOS Cycle
      2. 1.8.2 Computer Hardware
      3. 1.8.3 Software and Users
      4. 1.8.4 Types of Computers
    9. 1.9 This Textbook
    10. 1.10 Chapter Review
    11. Review Questions
  6. Chapter 2 - The Bash Shell
    1. 2.1 Introduction
    2. 2.2 Entering Linux Commands
      1. 2.2.1 Simple Linux Commands
      2. 2.2.2 Commands with Options and Parameters
    3. 2.3 Man Pages
    4. 2.4 Bash Features
      1. 2.4.1 Recalling Commands through History
      2. 2.4.2 Shell Variables
      3. 2.4.3 Aliases
      4. 2.4.4 Command Line Editing
      5. 2.4.5 Redirection
      6. 2.4.6 Other Useful Bash Features
    5. 2.5 Other Shells
    6. 2.6 Interpreters
      1. 2.6.1 Interpreters in Programming Languages
      2. 2.6.2 Interpreters in Shells
      3. 2.6.3 The Bash Interpreter
    7. 2.7 Chapter Review
    8. Review Questions
  7. Chapter 3 - Navigating the Linux File System
    1. 3.1 Introduction
      1. 3.1.1 File System Terminology
      2. 3.1.2 A Hierarchical File System
    2. 3.2 Filename Specification
      1. 3.2.1 The Path
      2. 3.2.2 Specifying Paths above and below the Current Directory
      3. 3.2.3 Filename Arguments with Paths
      4. 3.2.4 Specifying Filenames with Wildcards
    3. 3.3 File System Commands
      1. 3.3.1 Directory Commands
      2. 3.3.2 File Movement and Copy Commands
      3. 3.3.3 File Deletion Commands
      4. 3.3.4 Creating and Deleting Directories
      5. 3.3.5 Textfile Viewing Commands
      6. 3.3.6 File Comparison Commands
      7. 3.3.7 File Manipulation Commands
      8. 3.3.8 Other File Commands of Note
      9. 3.3.9 Hard and Symbolic Links
    4. 3.4 Locating Files
      1. 3.4.1 The GUI Search Tool
      2. 3.4.2 The Find Command
      3. 3.4.3 Other Means of Locating Files
    5. 3.5 Permissions
      1. 3.5.1 What Are Permissions?
      2. 3.5.2 Altering Permissions from the Command Line
      3. 3.5.3 Altering Permissions from the GUI
      4. 3.5.4 Advanced Permissions
    6. 3.6 Linux File System Structure
    7. 3.7 Secondary Storage Devices
      1. 3.7.1 The Hard Disk Drive
      2. 3.7.2 Magnetic Tape
      3. 3.7.3 Optical Disk and USB Drive
    8. 3.8 File Compression
      1. 3.8.1 Types of File Compression
      2. 3.8.2 The LZ Algorithm for Lossless Compression
      3. 3.8.3 Other Lossless Compression Algorithms
    9. 3.9 Chapter Review
    10. Review Questions
  8. Chapter 4 - Managing Processes
    1. 4.1 Introduction
    2. 4.2 Forms of Process Management
      1. 4.2.1 Single Process Execution
      2. 4.2.2 Concurrent Processing
      3. 4.2.3 Interrupt Handling
    3. 4.3 Starting, Pausing, and Resuming Processes
      1. 4.3.1 Ownership of Running Processes
      2. 4.3.2 Launching Processes from a Shell
    4. 4.4 Monitoring Processes
      1. 4.4.1 GUI Monitoring Tools
      2. 4.4.2 Command-Line Monitoring Tools
    5. 4.5 Managing Linux Processes
    6. 4.6 Killing Processes
      1. 4.6.1 Process Termination
      2. 4.6.2 Methods of Killing Processes
      3. 4.6.3 Methods to Shut Down Linux
    7. 4.7 Chapter Review
    8. Review Questions
  9. Chapter 5 - Linux Applications
    1. 5.1 Introduction
    2. 5.2 Text Editors
      1. 5.2.1 vi (vim)
      2. 5.2.2 emacs
      3. 5.2.3 gedit
    3. 5.3 Productivity Software
    4. 5.4 LaTeX
    5. 5.5 Encryption Software
      1. 5.5.1 What Is Encryption?
      2. 5.5.2 Openssl
    6. 5.6 Email Programs
      1. 5.6.1 Sending Email Messages
      2. 5.6.2 Reading Email Messages
    7. 5.7 Network Software
      1. 5.7.1 Internet Protocol Addressing
      2. 5.7.2 Remote Access and File Transfer Programs
      3. 5.7.3 Linux Network Inspection Programs
    8. 5.8 Chapter Review
    9. Review Problems
  10. Chapter 6 - Regular Expressions
    1. 6.1 Introduction
    2. 6.2 Metacharacters
      1. 6.2.1 Controlling Repeated Characters through *, +, and ?
      2. 6.2.2 Using and Modifying the ‘.’ Metacharacter
      3. 6.2.3 Controlling Where a Pattern Matches
      4. 6.2.4 Matching from a List of Options
      5. 6.2.5 Matching Characters That Must Not Appear
      6. 6.2.6 Matching Metacharacters Literally
      7. 6.2.7 Controlling Repetition
      8. 6.2.8 Selecting between Sequences
    3. 6.3 Examples
    4. 6.4 grep
      1. 6.4.1 Using grep/egrep
      2. 6.4.2 Useful egrep Options
      3. 6.4.3 Additional egrep Examples
      4. 6.4.4 A Word of Caution: Use Single Quote Marks
    5. 6.5 Sed
      1. 6.5.1 Basic sed Syntax
      2. 6.5.2 Placeholders
    6. 6.6 awk
      1. 6.6.1 Simple awk Pattern-Action Pairs
      2. 6.6.2 BEGIN and END Sections
      3. 6.6.3 More Complex Conditions
      4. 6.6.4 Other Forms of Control
    7. 6.7 Chapter Review
    8. Review questions
  11. Chapter 7 - Shell Scripting
    1. 7.1 Introduction
    2. 7.2 Simple Scripting
      1. 7.2.1 Scripts of Linux Instructions
      2. 7.2.2 Running Scripts
      3. 7.2.3 Scripting Errors
    3. 7.3 Variables, Assignments, and Parameters
      1. 7.3.1 Bash Variables
      2. 7.3.2 Assignment Statements
      3. 7.3.3 Executing Linux Commands from within Assignment Statements
      4. 7.3.4 Arithmetic Operations in Assignment Statements
      5. 7.3.5 String Operations Using expr
      6. 7.3.6 Parameters
    4. 7.4 Input and Output
      1. 7.4.1 Output with echo
      2. 7.4.2 Input with read
    5. 7.5 Selection Statements
      1. 7.5.1 Conditions for Strings and Integers
      2. 7.5.2 File Conditions
      3. 7.5.3 The If-Then and If-Then-Else Statements
      4. 7.5.4 Nested Statements
      5. 7.5.5 Case Statement
      6. 7.5.6 Conditions outside of Selection Statements
    6. 7.6 Loops
      1. 7.6.1 Conditional Loops
      2. 7.6.2 Counter-Controlled Loops
      3. 7.6.3 Iterator Loops
      4. 7.6.4 Using the Seq Command to Generate a List
      5. 7.6.5 Iterating over Files
      6. 7.6.6 The While Read Statement
    7. 7.7 Arrays
      1. 7.7.1 Declaring and Initializing Arrays
      2. 7.7.2 Accessing Array Elements and Entire Arrays
      3. 7.7.3 Example Scripts Using Arrays
    8. 7.8 String Manipulation
      1. 7.8.1 Substrings Revisited
      2. 7.8.2 String Regular Expression Matching
    9. 7.9 Functions
      1. 7.9.1 Defining Bash Functions
      2. 7.9.2 Using Functions
      3. 7.9.3 Functions and Variables
      4. 7.9.4 Exit and Return Statements
    10. 7.10 C-shell Scripting
      1. 7.10.1 Variables, Parameters, and Commands
      2. 7.10.2 Input and Output
      3. 7.10.3 Control Statements
      4. 7.10.4 Reasons to Avoid csh Scripting
    11. 7.11 Chapter Review
    12. Review questions
  12. Chapter 8 - Installing Linux
    1. 8.1 Introduction
      1. 8.1.1 Installation Using Virtual Machines
      2. 8.1.2 Preinstallation Questions
    2. 8.2 The Linux-Operating System
      1. 8.2.1 Operating Systems and Modes of Operation
      2. 8.2.2 System Calls
      3. 8.2.3 The Kernel
      4. 8.2.4 Loading and Removing Modules
    3. 8.3 Installing CentOS 6
      1. 8.3.1 The Basic Steps
      2. 8.3.2 Disk-Partitioning Steps
      3. 8.3.3 Finishing Your Installation
    4. 8.4 Installing Ubuntu
    5. 8.5 Software Installation Choices
    6. 8.6 Virtual Memory
    7. 8.7 Setting Up Network Connectivity and a Printer
      1. 8.7.1 Establishing Network Connections
      2. 8.7.2 Establishing Printers
    8. 8.8 SELinux
      1. 8.8.1 SELinux Components
      2. 8.8.2 Altering Contexts
      3. 8.8.3 Rules
    9. 8.9 Chapter Review
    10. Review Problems
  13. Chapter 9 - User Accounts
    1. 9.1 Introduction
    2. 9.2 Creating Accounts and Groups
      1. 9.2.1 Creating User and Group Accounts through the GUI
      2. 9.2.2 Creating User and Group Accounts from the Command Line
      3. 9.2.3 Creating a Large Number of User Accounts
    3. 9.3 Managing Users and Groups
      1. 9.3.1 GUI User Manager Tool
      2. 9.3.2 Command Line User and Group Management
    4. 9.4 Passwords
      1. 9.4.1 Ways to Automatically Generate Passwords
      2. 9.4.2 Managing Passwords
      3. 9.4.3 Generating Passwords in Our Script
    5. 9.5 PAM
      1. 9.5.1 What Does PAM Do?
      2. 9.5.2 Configuring PAM for Applications
      3. 9.5.3 An Example Configuration File
    6. 9.6 Establishing Common User Resources
      1. 9.6.1 Populating User Home Directories with Initial Files
      2. 9.6.2 Initial User Settings and Defaults
    7. 9.7 The sudo Command
    8. 9.8 Establishing User and Group Policies
      1. 9.8.1 We Should Ask Some Questions before Generating Policies
      2. 9.8.2 Four Categories of Computer Usage Policies
    9. 9.9 Chapter Review
    10. Review Questions
  14. Chapter 10 - The Linux File System
    1. 10.1 Introduction
    2. 10.2 Storage Access
      1. 10.2.1 Disk Storage and Blocks
      2. 10.2.2 Block Indexing Using a File Allocation Table
      3. 10.2.3 Other Disk File Details
    3. 10.3 Files
      1. 10.3.1 Files versus Directories
      2. 10.3.2 Nonfile File Types
      3. 10.3.3 Links as File Types
      4. 10.3.4 File Types
      5. 10.3.5 inode
      6. 10.3.6 Linux Commands to Inspect inodes and Files
    4. 10.4 Partitions
      1. 10.4.1 File System Redefined
      2. 10.4.2 Viewing the Available File Systems
      3. 10.4.3 Creating Partitions
      4. 10.4.4 Altering Partitions
      5. 10.4.5 Using a Logical Volume Manager to Partition
      6. 10.4.6 Mounting and Unmounting File Systems
      7. 10.4.7 Establishing Quotas on a File System
    5. 10.5 Linux Top-Level Directories Revisited
      1. 10.5.1 Root Partition Directories
      2. 10.5.2 /dev, /proc, and /sys
      3. 10.5.3 The /etc Directory
      4. 10.5.4 /home
      5. 10.5.5 /usr
      6. 10.5.6 /var
      7. 10.5.7 Directories and Changes
    6. 10.6 Other System Administration Duties
      1. 10.6.1 Monitoring Disk Usage
      2. 10.6.2 Identifying Bad Blocks and Disk Errors
      3. 10.6.3 Protecting File Systems
      4. 10.6.4 Isolating a Directory within a File System
    7. 10.7 Chapter Review
    8. Review Problems
  15. Chapter 11 - System Initialization and Services
    1. 11.1 Introduction
    2. 11.2 Boot Process
      1. 11.2.1 Volatile and Nonvolatile Memory
      2. 11.2.2 Boot Process
    3. 11.3 Boot Loading in Linux
      1. 11.3.1 Boot Loaders
      2. 11.3.2 Loading the Linux Kernel
    4. 11.4 Initialization of the Linux Operating System
      1. 11.4.1 inittab File and Runlevels
      2. 11.4.2 Executing rcS.conf and rc.sysinit
      3. 11.4.3 rc.conf and rc Scripts
      4. 11.4.4 Finalizing System Initialization
    5. 11.5 Linux Services
      1. 11.5.1 Categories of Services
      2. 11.5.2 Examination of Significant Linux Services
      3. 11.5.3 Starting and Stopping Services
      4. 11.5.4 Examining the atd Service Control Script
    6. 11.6 Configuring Services through GUI Tools
      1. 11.6.1 Firewall Configuration Tool
      2. 11.6.2 kdump Configuration Tool
    7. 11.7 Configuring Services through Configuration Files
      1. 11.7.1 Configuring Syslog
      2. 11.7.2 Configuring nfs
      3. 11.7.3 Other Service Configuration Examples
    8. 11.8 Chapter Review
    9. Review Problems
  16. Chapter 12 - Network Configuration
    1. 12.1 Introduction
    2. 12.2 Computer Networks and TCP/IP
      1. 12.2.1 Broadcast Devices
      2. 12.2.2 The TCP/IP Protocol Stack
      3. 12.2.3 Ports
      4. 12.2.4 IPv6
      5. 12.2.5 Domains, the DNS, and IP Aliases
    3. 12.3 Network Services and Files
      1. 12.3.1 The Network Service
      2. 12.3.2 The /etc/sysconfig/network-scripts Directory’s Contents
      3. 12.3.3 Other Network Services
      4. 12.3.4 The xinetd Service
      5. 12.3.5 Two /etc Network Files
    4. 12.4 Obtaining IP Addresses
      1. 12.4.1 Static IP Addresses
      2. 12.4.2 Dynamic IP Addresses
      3. 12.4.3 Setting up a DHCP Server
    5. 12.5 Network Programs
      1. 12.5.1 The ip Program
      2. 12.5.2 Other Network Commands
    6. 12.6 The Linux Firewall
      1. 12.6.1 The iptables-config File
      2. 12.6.2 Rules for the iptables File
      3. 12.6.3 Examples of Firewall Rules
    7. 12.7 Writing Your Own Network Scripts
      1. 12.7.1 A Script to Test Network Resource Response
      2. 12.7.2 A Script to Test Internet Access
      3. 12.7.3 Scripts to Compile User Login Information
    8. 12.8 Chapter Review
    9. Review Questions
  17. Chapter 13 - Software Installation and Maintenance
    1. 13.1 Introduction
    2. 13.2 Software Installation Questions
    3. 13.3 Installing Software from a GUI
      1. 13.3.1 Add/Remove Software GUI in CentOS
      2. 13.3.2 Ubuntu Software Center
    4. 13.4 Installation from Package Manager
      1. 13.4.1 RPM
      2. 13.4.2 YUM
      3. 13.4.3 APT
    5. 13.5 Installation of Source Code
      1. 13.5.1 Obtaining Installation Packages
      2. 13.5.2 Extracting from the Archive
      3. 13.5.3 Running the configure Script
      4. 13.5.4 The make Step
      5. 13.5.5 The make install Step
    6. 13.6 The gcc Compiler
      1. 13.6.1 Preprocessing
      2. 13.6.2 Lexical Analysis and Syntactic Parsing
      3. 13.6.3 Semantic Analysis, Compilation, and Optimization
      4. 13.6.4 Linking
      5. 13.6.5 Using gcc
    7. 13.7 Software Maintenance
      1. 13.7.1 Updating Software through rpm and yum
      2. 13.7.2 System Updating from the GUI
      3. 13.7.3 Software Documentation
      4. 13.7.4 Software Removal
    8. 13.8 The Open Source Movement
      1. 13.8.1 Evolution of Open Source
      2. 13.8.2 Why Do People Participate in the Open Source Community?
    9. 13.9 Chapter Review
    10. Review Questions
  18. Chapter 14 - Maintaining and Troubleshooting Linux
    1. 14.1 Introduction
    2. 14.2 Backups and File System Integrity
      1. 14.2.1 Examining File System Usage
      2. 14.2.2 RAID for File System Integrity
      3. 14.2.3 Backup Strategies
    3. 14.3 Task Scheduling
      1. 14.3.1 The at Program
      2. 14.3.2 The crontab Program
    4. 14.4 System Monitoring
      1. 14.4.1 Liveness and Starvation
      2. 14.4.2 Fairness
      3. 14.4.3 Process System-Monitoring Tools
      4. 14.4.4 Memory System-Monitoring Tools
      5. 14.4.5 I/O System-Monitoring Tools
    5. 14.5 Log Files
      1. 14.5.1 syslogd Created Log Files
      2. 14.5.2 Audit Logs
      3. 14.5.3 Other Log Files of Note
      4. 14.5.4 Log File Rotation
    6. 14.6 Disaster Planning and Recovery
    7. 14.7 Troubleshooting
    8. 14.8 Chapter Review
    9. Review Questions
  19. Bibliography
  20. Appendix: Binary and Boolean Logic
    1. A.1 Binary Numbering System
    2. A.2 Converting Unsigned Numbers
    3. A.3 Hexadecimal and Octal Representations
    4. A.4 Storage Capacities
    5. A.5 Boolean Logic
    6. A.6 Chapter Review
    7. Review Questions