We may earn an affiliate commission when you visit our partners.
Course image
Udemy logo

Linux Shell Scripting

A Project-Based Approach to Learning

Jason Cannon

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?

Read more

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.

Enroll now

What's inside

Learning objective

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

Syllabus

Course Introduction

Welcome to this Linux Shell Scripting course!

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

Read more
Creating a Local Linux Shell Scripting Environment

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

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

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.

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

Learn how to install Vagrant and VirtualBox on Mac.

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.

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

This lecture is only for those who are using computers with an Apple Silicon chip, such as the M1, M2, or later. If you are using a slightly older Mac computer using an Intel chip, skip this lesson. If you are not using Mac, you should also skip this lesson.

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

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

User and Account Creation - Shell Scripting Project 1
Section Introduction
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.



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.

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.


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

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.

Password Generation and Shell Script Arguments - Shell Scripting Project 2

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.)

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 $*.

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
Exercise 3 - Walkthrough
Linux Programming Conventions - Shell Scripting Project 3

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.

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
Exercise 4 - Walkthrough
Parsing Command Line Options – Shell Scripting Project 4

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

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.


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.


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

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.

Demonstration of the userdel and id commands.

Demonstration of the tar, gzip, and gunzip commands.

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

Deleting Users – Exercise 5 – Instructions
Deleting Users – Exercise 5 – Walkthrough
Transforming Data / Data Processing / Reporting – Shell Scripting Project 5

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

Demonstration of using the cut and awk commands.

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

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

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

Network Scripting & Automation of Distributed Systems: Shell Scripting Project 6

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.

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
Scripting Remote Commands – Walkthrough – Part 2
Course Summary

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

Course Extras

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 Section

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

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Explores shell scripting, which is standard in Linux systems administration
Teaches shell scripting through project-based learning
Develops skills that are core to Linux systems professionals
Taught by Jason Cannon, who is recognized for their work in shell scripting
Covers a wide range of shell scripting topics, from fundamentals to advanced techniques
Suitable for students with no prior shell scripting experience

Save this course

Save Linux Shell Scripting: A Project-Based Approach to Learning to your list so you can find it easily later:
Save

Reviews summary

Good course learning shell scripting

Learners say that this course is very good at teaching Linux shell scripting. However, learners also noted some technical glitches in the course. About half way through the course, the sound quit working in Google Chrome and learners had to switch to a different browser to complete the course.
Some learners report finding bugs.
"The course was very good. The biggest problem was trying to run trying to run the O/S from a Virtual Server. There were some permission issues with it."
"Also about half-way through the tutorial, the sound quit working in Google Chrome."

Career center

Learners who complete Linux Shell Scripting: A Project-Based Approach to Learning will develop knowledge and skills that may be useful to these careers:
Network Engineer
Network Engineers design, implement, and maintain computer networks. They ensure that these networks are reliable, secure, and efficient. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Network Engineers. Shell scripting can be used to automate tasks, manage network devices, and perform other network engineering tasks. This can help you to be more efficient and productive in your role as a Network Engineer.
Systems Administrator
Systems Administrators are responsible for the day-to-day operation of computer systems, including networks, servers, and databases. They ensure that these systems are running smoothly and efficiently, and they troubleshoot and resolve any problems that arise. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Systems Administrators. Shell scripting can be used to automate tasks, manage files and directories, and perform other system administration tasks. This can help you to be more efficient and productive in your role as a Systems Administrator.
DevOps Engineer
DevOps Engineers work to bridge the gap between software development and IT operations. They ensure that software applications are deployed and maintained efficiently and reliably. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for DevOps Engineers. Shell scripting can be used to automate tasks, manage infrastructure, and perform other DevOps tasks. This can help you to be more efficient and productive in your role as a DevOps Engineer.
Software Engineer
Software Engineers design, develop, and maintain software applications. They ensure that these applications are reliable, secure, and efficient. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Software Engineers. Shell scripting can be used to automate tasks, manage files and directories, and perform other software development tasks. This can help you to be more efficient and productive in your role as a Software Engineer.
Database Administrator
Database Administrators are responsible for the day-to-day operation of databases. They ensure that these databases are running smoothly and efficiently, and they troubleshoot and resolve any problems that arise. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Database Administrators. Shell scripting can be used to automate tasks, manage databases, and perform other database administration tasks. This can help you to be more efficient and productive in your role as a Database Administrator.
IT Consultant
IT Consultants provide advice and guidance to organizations on how to use technology to improve their business operations. They help organizations to select, implement, and manage technology solutions. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for IT Consultants. Shell scripting can be used to automate tasks, manage IT infrastructure, and perform other IT consulting tasks. This can help you to be more efficient and productive in your role as an IT Consultant.
IT Auditor
IT Auditors assess the security and efficiency of computer systems and networks. They identify and evaluate risks, and they make recommendations to improve security and efficiency. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for IT Auditors. Shell scripting can be used to automate tasks, manage audit logs, and perform other audit tasks. This can help you to be more efficient and productive in your role as an IT Auditor.
Product Manager
Product Managers are responsible for the development and marketing of software products. They work with engineers, designers, and marketers to create products that meet the needs of customers. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Product Managers. Shell scripting can be used to automate tasks, manage product documentation, and perform other product management tasks. This can help you to be more efficient and productive in your role as a Product Manager.
Technical Writer
Technical Writers create documentation for computer systems and software applications. They explain how these systems and applications work, and they provide instructions on how to use them. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Technical Writers. Shell scripting can be used to automate tasks, manage documentation, and perform other technical writing tasks. This can help you to be more efficient and productive in your role as a Technical Writer.
Security Analyst
Security Analysts are responsible for protecting computer systems and networks from security threats. They identify, assess, and mitigate these threats, and they develop and implement security measures to prevent them from happening in the first place. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Security Analysts. Shell scripting can be used to automate tasks, manage security tools, and perform other security analysis tasks. This can help you to be more efficient and productive in your role as a Security Analyst.
Project Manager
Project Managers are responsible for planning, executing, and closing projects. They work with stakeholders to define project scope, timelines, and budgets. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Project Managers. Shell scripting can be used to automate tasks, manage project documents, and perform other project management tasks. This can help you to be more efficient and productive in your role as a Project Manager.
Quality Assurance Analyst
Quality Assurance Analysts test software applications to ensure that they are working correctly and efficiently. They identify and report bugs, and they work with developers to fix these bugs. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Quality Assurance Analysts. Shell scripting can be used to automate tasks, manage test cases, and perform other quality assurance tasks. This can help you to be more efficient and productive in your role as a Quality Assurance Analyst.
Data Scientist
Data Scientists use data to solve business problems. They collect, analyze, and interpret data to help organizations make informed decisions. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Data Scientists. Shell scripting can be used to automate tasks, manage data, and perform other data science tasks. This can help you to be more efficient and productive in your role as a Data Scientist.
Business Analyst
Business Analysts work with stakeholders to understand their business needs and develop solutions to meet those needs. They analyze data, identify problems, and recommend solutions. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Business Analysts. Shell scripting can be used to automate tasks, manage data, and perform other business analysis tasks. This can help you to be more efficient and productive in your role as a Business Analyst.
Data Analyst
Data Analysts collect, analyze, and interpret data to help organizations make informed decisions. This course can help you build a foundation in Linux shell scripting, which is a valuable skill for Data Analysts. Shell scripting can be used to automate tasks, manage data, and perform other data analysis tasks. This can help you to be more efficient and productive in your role as a Data Analyst.

Reading list

We've selected 18 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Linux Shell Scripting: A Project-Based Approach to Learning.
Comprehensive and authoritative guide to advanced Linux programming. It covers topics such as kernel internals, system calls, and concurrency, providing a deep dive into the inner workings of the Linux operating system.
This comprehensive guide to Unix shell programming covers a wide range of topics, from basic concepts to advanced techniques. It's a valuable resource for both beginners and experienced users who want to deepen their understanding of shell scripting.
Offers a comprehensive overview of the Linux command line, including essential commands, tools, and techniques. It serves as a valuable resource for beginners and intermediate users looking to strengthen their foundation in Linux shell scripting.
Provides a collection of recipes for common shell scripting tasks, such as file manipulation, text processing, and system administration. It useful reference for those who want to learn how to write effective shell scripts.
Provides a comprehensive guide to advanced bash scripting techniques, such as functions, arrays, and regular expressions. It valuable resource for those who want to learn how to write complex and efficient shell scripts.
Explores DevOps principles and practices, with a focus on collaboration, automation, and continuous improvement. It provides valuable insights for learners interested in extending their shell scripting skills into the realm of DevOps.
Offers a practical approach to shell programming, focusing on real-world examples and applications. It's a valuable resource for learners who want to gain a deeper understanding of how shell scripts are used in practice.
Delves into the powerful text processing tools sed and awk, which are essential for manipulating and transforming data in shell scripts. It's a valuable resource for learners who want to enhance their data processing capabilities.
This introductory guide to the bash shell provides a solid foundation for beginners. It covers essential concepts, commands, and techniques, making it a useful resource for learners who are new to shell scripting.
This beginner-friendly guide provides a gentle introduction to the bash shell. It covers basic concepts, commands, and techniques, making it a good starting point for learners who are new to shell scripting.
Provides a quick reference to the grep command, which powerful tool for searching text. It valuable resource for those who want to learn how to use this command effectively.
Provides a comprehensive guide to Linux system programming, covering topics such as process management, memory management, and file systems. It valuable resource for those who want to learn how to develop software for the Linux operating system.
Provides a comprehensive guide to Unix network programming, covering topics such as sockets, networking protocols, and network security. It valuable resource for those who want to learn how to develop network applications for the Unix operating system.
Provides a history of the Unix operating system and its impact on the development of the Internet. It fascinating read for those who want to learn more about the origins of Unix.
Provides a concise and accessible introduction to operating systems concepts. It valuable resource for those who want to learn the basics of operating systems.
Provides a comprehensive overview of computer networks, covering topics such as network architecture, protocols, and applications. It valuable resource for those who want to learn the basics of computer networks.
Provides a comprehensive guide to the TCP/IP protocol suite, which is the foundation of the Internet. It valuable resource for those who want to learn the details of how the Internet works.
Provides a comprehensive guide to writing Linux device drivers, covering topics such as device I/O, interrupt handling, and power management. It valuable resource for those who want to learn how to develop software that interacts with hardware devices.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Linux Shell Scripting: A Project-Based Approach to Learning.
Volt Typhoon: T1059.003 Command and Scripting Interpreter...
Most relevant
Linux Commands & Shell Scripting
Most relevant
Hands-on Introduction to Linux Commands and Shell...
Most relevant
The Linux Command Line Bootcamp: Beginner To Power User
Most relevant
The Bash Shell and Basic Scripting in Linux
Most relevant
Introduction to Bash Shell Scripting
Most relevant
Create Python Linux Script to Generate a Disk Usage Report
Most relevant
Learn Ubuntu Fast: Learn, Practice, and Advance your...
Most relevant
Creating Shell Scripts in Enterprise Linux
Most relevant
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser