logo_php.gif

liber4e
 
 
 
 
 



GL375 - Linux Shell Scripting

The GL375 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 GL375 in a format that benefits all students, with or without previous programming experience. Guru Labs believes that 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, students are encouraged to create their own before examining the solution. In this way, more experienced students are challenged without overwhelming the less experienced.

Current Version: F00

Prerequisites:

Solid understanding of Unix-based systems and proficiency on the Unix or Linux command line.

Supported Distributions:

Red Hat Enterprise Linux 6

SUSE Linux Enterprise 11

Course Outline:

  1. Introduction to the Shell

    1. Shell Script Strengths and Weaknesses

    2. Shells

    3. Example Shell Script

    4. Shell and Environment Variables

    5. Key Environment Variables

    6. General Quoting Rules

    7. Nesting Commands

    8. Help from Commands and Documentation

    9. Getting Help with man & info

  2. Lab Tasks

    1. Shell Variables

    2. Shell Meta-Characters

    3. Command Substitution

  3. Shell Scripting Basics

    1. Positional Parameters

    2. printf

    3. Input & Output

    4. alias

    5. Functions

    6. Colors in Scripts

    7. Custom Bash Prompts

  4. Lab Tasks

    1. Aliases

    2. Bash Login Scripts

    3. Create "userinfo" and "sysinfo" functions

  5. 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 mail

  6. Lab Tasks

    1. Disk and Filesystem Usage

    2. Connecting Commands

  7. Regular Expressions

    1. Searching Inside Files

    2. Regular Expression Overview

    3. Regular Expressions

    4. RE Character Classes

    5. RE Quantifiers

    6. RE Parenthesis

    7. The Streaming Editor

  8. Lab Tasks

    1. Pattern Matching with Regular Expressions

    2. Extended Regular Expressions

    3. Using Regular Expressions With sed

  9. 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 for Loop

    7. Flow Control: select

  10. Lab Tasks

    1. Reporting User Statistics

    2. Monitoring Filesystem Usage

  11. Data Munging

    1. Text Processing with awk

    2. Text Sorting

    3. Duplicate Removal Utility

    4. Extracting Columns of Text

  12. Lab Tasks

    1. Create "rmhost" function

    2. Create "showenv" function

    3. Parsing Mail Server Logs

    4. Fixing Incorrect Files

  13. Security, Whitespace and Other Gotchas

    1. Gotchas: Maximum Command Length

    2. Gotcha: Whitespace in for Loops

    3. Reading Files with while

    4. Gotcha: $IFS

    5. Gotcha: Printing in .bashrc

    6. Gotcha: Aliases

  14. Lab Tasks

    1. Renaming MP3 Files

    2. Split and Display $PATH

    3. A tar-based Backup

  1. Challenge Lab Tasks

    1. Automated Virtual Host Provisioning

 

Jose Nuno Neto
 
 
 
 
linux mysql
apache php