Linux Shell Scripting Projects

Learn how to shell script through project-based training (Bash Scripting, Bash Programming, Sed, Grep, Awk, and More)

Last updated 2022-01-10 | 4.6

- Write your very own Linux shell scripts using the concepts you learned in this course.

What you'll learn

Write your very own Linux shell scripts using the concepts you learned in this course.

* Requirements

* A basic understanding of the Linux command line.
* The ability to download large files of about 500 MB from the Internet.
* Access to a computer with a 64-bit processor running either Windows
* Mac
* or Linux. (You do NOT need Linux already installed to take this course.)

Description

Have you tried to learn shell scripting on your own, but lack the structure you need to really improve your skills?

Are you tired of picking up bits and pieces of information that you can't just seem to put together?

Do you learn best by doing?

If so, you're going to love this course.

One of the biggest complaints I hear from students is that most of the courses they've taken in the past simply provide information without any context and without any idea of how to put that information to use!  

This course turns that old, frustrating, and outdated way of learning on its head.  

It's project-based, which means instead of learning bits and pieces of information, you'll write actual shell scripts that you can use in real-world situations. You get the chance to immediately put what you learn to use so that you fully understand and remember it.

In this Linux shell scripting course you will learn how to:

  • Name your shell scripts.
  • Use the proper permissions on your shell scripts.
  • Create and use variables in your scripts.
  • Use shell built-in commands and operating system commands.
  • Make the most out of special variables that are available to you in your scripts.
  • Make decisions by using if statements and performing several different kinds of tests
  • Check the exit statuses of commands and why you need to.
  • Use cryptographic hash functions
  • Create random data so you can do things like automatically generate strong passwords for user accounts.
  • Perform the same action or set of actions over a series of data utilizing for loops, while loops, and infinite loops.
  • Control all types of input and output.
  • Accept standard input from a user as well as from another program.
  • Redirect standard output and standard error.
  • Combine standard output and standard error
  • Use command pipelining
  • Perform text and string manipulation.
  • Process command line arguments
  • Creating functions and when to do so.
  • Parsing, analyzing, and reporting on log files, CSV files, and other data.
  • Writing scripts that execute commands on other systems.
  • Much, much, more...

When you enroll, you get lifetime access to the course.  Your course never expires.  You can study at your own pace and refer back to the lessons whenever you want!

I stand behind my courses and care about your goals.  That's why this course comes with an unconditional 30-day money-back guarantee. It's my personal promise of your success!  So...

If you're ready to level-up your shell scripting skills, enroll now!

Who this course is for:

  • Anyone who wants to master Linux shell scripting, bash scripting, and the bash shell.
  • Linux system administrators, developers, or programmers.

Course content

11 sections • 48 lectures

Introduction and Course Overview Preview 01:41

Welcome to this Linux Shell Scripting course!

Course Downloads Preview 02:52

Download the shell scripting class files that include solutions to the exercises.

Creating a Local Lab Environment Using Vagrant and VirtualBox - Background Preview 16:28

How to create a local lab environment using Vagrant and VirtualBox.

Exercise 1 Instructions - Creating a Local Linux Shell Scripting Lab Environment Preview 11:58

Instructions for creating a local lab environment using Vagrant and VirtualBox.

Exercise 1 – Walkthrough – Part I – Windows Users Only Preview 04:18

Note: Only use this lesson if you are using Windows as your operating system.  If you are not, proceed to the next lesson.

Learn how to install Vagrant and VirtualBox on Windows.

Exercise 1 – Walkthrough – Part I – Mac Users Only Preview 03:15

Note: Only use this lesson if you are using Mac as your operating system.  If you are not, proceed to the next lesson.

Learn how to install Vagrant and VirtualBox on Mac.

Exercise 1 – Walkthrough – Part I – Linux (CentOS/RHEL) Users Only Preview 02:53

Note: Only use this lesson if you are using CentOS or Red Hat Enterprise Linux as your operating system.  If you not, proceed to the next lesson.

Learn how to install Vagrant and VirtualBox on CentOS/RHEL.

Exercise 1 – Walkthrough – Part II – All Users Preview 22:54

Note: This lesson is for everyone, no matter what operating system you are using.  (Windows, Mac, CentOS, RHEL)

Vagrant and VirtualBox Troubleshooting Tips Preview 08:02

If you encountered errors with Vagrant or Virtualbox, use the strategies in this lesson to fix those issues.

Section Introduction Preview 02:47

Getting Started with Shell Scripting: Naming, Permissions, Variables, Builtins. Preview 35:02

Concepts covered in this lesson:

  • Naming shell scripts and file extensions.
  • Shell script file permissions and the chmod command.
  • Shebangs
  • Comments
  • Variables
  • Quoting – single vs double quotes.
  • Shell Builtins including echo, type, and help.
  • Displaying information to the screen with the echo shell builtin.
  • Getting help on shell builtins by using the help builtin.
  • Getting help on Linux commands by using the man command.
  • The touch command.



Special Variables, Pseudocode, Command Substitution, if Statement, Conditionals. Preview 23:14

Shell scripting concepts covered in this lesson:

  • Pseudocode and pseudocoding.

  • Special variables created by the shell including UID.

  • How to store the output of a command in a variable with command substitution.

  • The if statement.

  • The id command.

  • The whoami command.

  • How to read help and man pages.

  • Command options, order, and conventions.

  • Conditionals, operators, and expressions.

  • The [[, [, and, test shell builtins.

  • The command separator.

  • Exit statuses.

  • Piping output to the less pager.

  • Executing commands as root with the sudo command.

  • Using the su command to switch users.

  • Sanity and “idiot” checking.

Exit Statuses, Return Codes, String Test Conditionals, More Special Variables. Preview 17:38

Concepts covered in this lesson:

  • Exit status conventions.

  • Controlling the exit status of your shell script with the exit shell builtin.

  • Shell Special Variables.

  • Checking the return code or exit status of a command by examining the contents of the $? special variable.

  • String test conditionals.

  • DRY – Don’t Repeat Yourself.


Reading Standard Input, Creating Accounts, Username Conventions, More Quoting. Preview 23:26

Shell scripting concepts covered in this lesson:

  • Getting input from the person executing the script using the read shell builtin.

  • Introduction to standard input, standard output, and standard error.

  • Creating accounts with the useradd command.

  • Username conventions including length, case, and valid characters.

  • Using the “-” or “-l” options to the su command to simulate a full login when switching users.

  • Controlling the default account creation behaviors by editing the /etc/login.defs file.

  • Using quotes to make a string that contains spaces behave as a single argument or item.

  • Setting passwords with the passwd command interactively and programmatically.

  • Using pipes to chain together multiple commands.

  • Expiring accounts with the passwd command

Exercise 2 - Instructions Preview 04:16

The goal of this exercise is to create a shell script that adds users to the same Linux system as the script is executed on.

Exercise 2 - Walkthrough Preview 21:22

The goal of this exercise is to create a shell script that adds users to the same Linux system as the script is executed on.

Random Data, Cryptographic Hash Functions, Text and String Manipulation. Preview 31:01

Shell scripting concepts covered in this lesson:

  • Generating random data.

  • How to automate the creation of a random password.

  • The RANDOM shell builtin variable.

  • Event designators (shell shortcuts).

  • Display the current date and time using the date command in various formats.

  • Unix time, POSIX time, and epoch time.

  • Checksums and cryptographic hash functions.

  • The sha1sum and sha256sum commands.

  • Verifying downloads with checksums.

  • The head, fold, and shuf commands.

  • How to work through pipes. (Data munging, text manipulation, string manipulation.)

Positional Parameters, Arguments, for Loops, Special Parameters Preview 29:48

Shell Scripting concepts covered in this lesson:

  • Positional parameters. ($0, $1, $2, $3, etc.)

  • The difference between arguments and parameters.

  • The which command.

  • The command search path and the PATH shell variable.

  • The hash shell builtin.

  • The basename and dirname commands.

  • Using command substitution within another command without assigning it to a variable first.

  • The for loop.

  • Special parameters including $#, $@, and $*.

The while Loop, Infinite Loops, Shifting, Sleeping Preview 16:11

Shell scripting concepts covered in this lesson:

  • The while loop.

  • The true shell builtin.

  • The sleep command.

  • Creating and breaking out of infinite loops.

  • Send an interrupt signal by typing Ctrl-C.

  • The shift shell builtin.

Exercise 3 - Instructions Preview 04:32

Exercise 3 - Walkthrough Preview 20:07

Advanced Standard Input, Standard Output, and Standard Error - Part I Preview 13:26

Concepts covered in this lesson:

  • A deeper look at standard input, standard output, and standard error.
  • File descriptors.
  • Redirecting standard output to a file.
  • Redirecting standard error to a file.
  • Redirecting standard output and error to a file.
  • Redirecting standard input from a file.
  • Redirecting standard output and error through a pipe.
  • Redirecting standard error to standard output.
  • Redirecting standard output to standard error.
  • Overwriting and appending output to a file.
  • The null device.

Advanced Standard Input, Standard Output, and Standard Error - Part II Preview 25:47

Concepts covered in this lesson:

  • A deeper look at standard input, standard output, and standard error.
  • File descriptors.
  • Redirecting standard output to a file.
  • Redirecting standard error to a file.
  • Redirecting standard output and error to a file.
  • Redirecting standard input from a file.
  • Redirecting standard output and error through a pipe.
  • Redirecting standard error to standard output.
  • Redirecting standard output to standard error.
  • Overwriting and appending output to a file.
  • The null device.

Exercise 4 - Instructions Preview 04:53

Exercise 4 - Walkthrough Preview 11:57

Case Statements Preview 19:56

Learn how to use the "case" statement in your shell scripts.

Functions Preview 33:09

Shell scripting concepts covered in this lesson:

  • Reasons to create functions

  • DRY vs WET programming concepts:

    • DRY: Don’t Repeat Yourself

    • WET: Write Everything Twice, We Enjoy Typing, Waste Everyone’s Time

  • Defining functions

  • Calling functions

  • Sending messages to the syslog subsystem with the logger command.

  • Where to place functions in your script.

  • Variable scope and the local shell builtin.

  • Passing in data to a function.

  • Making variables read-only with the readonly shell builtin.

  • How to backup files before you change them.

  • Exit status of functions and the return command.


Parsing Command Line Options with getopts, Part 1 Preview 20:16

Shell scripting concepts covered in this lesson:

  • How to accept and parse command line options.

  • Why getopts is better than using an if or case statement.

  • Performing mathematical calculations in your scripts.

  • Using the basic calculator: bc.


Parsing Command Line Options with getopts, Part 2 Preview 17:34

Learn how to use "getops" in your shell scripts.

Deleting and Disabling Linux Accounts, Part 1 of 4 (Finding Files) Preview 11:23

Shell scripting concepts covered in this lesson:

  • Deleting users with the userdel command.

  • Expiring and locking accounts with the chage command.

  • How to find commands not in your PATH.

  • Using the locate and find commands.

  • Matching patterns with the grep command.

  • Using the !! and !$ event designators to speed up your workflow at the command line.

  • UID for system accounts and normal user accounts.

  • Creating and restoring backups and archives with the tar command.

  • How to compress files with gzip and uncompress them with gunzip.

  • Why not to lock accounts with the passwd command or by using the nologin shell.

Deleting and Disabling Linux Accounts, Part 2 of 4 (The userdel command) Preview 05:06

Demonstration of the userdel and id commands.

Deleting and Disabling Linux Accounts, Part 3 of 4 (Archives with tar) Preview 13:37

Demonstration of the tar, gzip, and gunzip commands.

Deleting and Disabling Linux Accounts, Part 4 of 4 (Disabling Accounts) Preview 08:08

Demonstration of using the chage, passwd, and usermod commands.

Deleting Users – Exercise 5 – Instructions Preview 05:48

Deleting Users – Exercise 5 – Walkthrough Preview 32:47

Cut and Awk Preview 21:37

In this lesson, you will learn how to use the "cut" and "awk" commands.

Cut and Awk Demonstration Script: Open Network Ports Preview 09:43

Demonstration of using the cut and awk commands.

Sort and Uniq Preview 18:05

In this lesson, you will learn how to use the sort and uniq commands.

Parsing Log Files - Exercise 6 - Instructions Preview 02:41

In this shell scripting exercise, you'll be parsing data using the awk, cut, sort, and uniq commands.

The goal of this exercise is to create a shell script that displays the number of failed login attempts by IP address and location.

Parsing Log Files - Exercise 6 - Walkthrough Preview 14:32

Sed Preview 28:50

In this lesson, you will learn how to use sed.

Configuring a Mini Network and Scripting for Remote Systems Preview 30:10

In this lesson you will learn how to create a small network of VMs that will simulate a company network.  You'll also learn how to configure ssh key authentication and execute commands on remote systems over ssh.

Scripting Remote Commands – Exercise – Instructions Preview 09:19

The goal of this exercise is to create a shell script that executes a given command on multiple servers.

Scripting Remote Commands – Walkthrough – Part 1 Preview 25:44

Scripting Remote Commands – Walkthrough – Part 2 Preview 12:37

Summary Preview 07:46

This lesson is reminder of just some shell scripting concepts and techniques you've learned during this course.

What Shell Scripting Is and Why You Should Learn It Preview 09:38

In this lesson, you will learn:

  • What shell scripts are.

  • Why you should learn bash shell scripting.

  • How shell scripts can be helpful to you.

  • Shell scripting examples and use cases.

Bonus Lecture Preview 01:04

The contents of this lecture are so secret I'm not even allowed to describe it! Open, if you dare.