Course Description
Course Overview
The Linux Shell Scripting course is designed to provide the
skills necessary to automate tasks on a Unix or Linux system. Systems
Administrators and Developers alike can avoid errors, save time and money by
replacing repetitive work patterns with shell scripts. Care has been taken to
present the Linux Shell Scripting course in a format that benefits all
students, with or without previous programming experience. The best way to
learn shell scripting is writing shell scripts. For this reason, lab time is emphasized.
Early labs present the scripting process step by step, while later labs are
presented in a challenge format. While official solutions to each lab task are
provided, you are encouraged to create your own before examining the solution.
In this way, more experienced learners are challenged without overwhelming the
less experienced.
Agenda
Course Outline
INTRODUCTION TO THE SHELL
1. Shell Script Strengths and Weaknesses
2. Shells
3. Switching User Contexts
4. Example Shell Script
5. Shell and Environment Variables
6. Key Environment Variables
7. Which and Type
8. General Quoting Rules
9. Nesting Commands
10. Help from Commands and Documentation
11. whereis
12. Getting Help Within the Graphical Desktop
13. Getting Help with man & info
14. Shell Variables
15. Shell Meta-Characters
16. Command Substitution
SHELL SCRIPTING BASICS
1. Positional Parameters
2. Input & Output
3. printf
4. alias
5. Functions
6. Colors in Scripts
7. Custom Bash Prompts
8. Aliases
9. Bash Login Scripts
10. Create "userinfo" and "sysinfo" functions
WORKING WITH FILES
1. Communication Channels
2. File Redirection
3. Piping Commands Together
4. Doing Math
5. Filesystem Structures
6. Determining Disk Usage With df and du
7. cron
8. The crontab Command
9. crontab Format
10. /etc/cron.*/ Directories
11. Sending Email with mailx
12. Disk and Filesystem Usage
13. Redirection and Pipes
REGULAR EXPRESSIONS
1. Searching Inside Files
2. Regular Expression Overview
3. Regular Expressions
4. RE Character Classes
5. Regex Quantifiers
6. RE Parenthesis
7. The Streaming Editor
8. Pattern Matching with Regular Expressions
9. Extended Regular Expressions
10. Using Regular Expressions With sed
BRANCHING AND LOOPING
1. Exit Status
2. Comparisons with test
3. Conditional Statements
4. Flow Control: case
5. Flow Control: while and until Loops
6. The borne for-Loop
7. Flow Control: select
8. Reporting User Statistics
9. Monitoring Filesystem Usage
DATA MUNGING
1. Text Processing with Awk
2. Text Sorting
3. Duplicate Removal Utility
4. Extracting Columns of Text
5. Create "rmhost" function
6. Create "showenv" function
7. Parsing Mail Server Logs
8. Fixing Incorrect Files
SECURITY, WHITESPACE, AND OTHER GOTCHAS
1. Gotcha: Quoting Variables
2. Gotcha: Locales
3. Gotchas: Maximum Command Length
4. Gotcha: Whitespace in for Loops
5. Reading Files with while
6. Gotcha: $IFS
7. Gotcha: Printing in .bashrc
8. Gotcha: Aliases
9. Renaming MP3 Files
10. Split and Display $PATH
11. A tar-based Backup
A. CHALLENGE
1. Apache Configuration Files
2. Virtual Host Configuration
3. Automated Virtual Host Provisioning
B. EMACS
1. Emacs
2. The Emacs Interface
3. Basic Emacs
4. More Emacs Commands
5. Text Editing with Emacs
C. THE SECURE SHELL (SSH)
1. OpenSSH Client & Server Configuration
2. Accessing Remote Shells
3. Transferring Files
4. SSH Key Management