Linux Bash Scripting for Beginners: Write Your Own Scripts
4.0 (33 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,441 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Linux Bash Scripting for Beginners: Write Your Own Scripts to your Wishlist.

Add to Wishlist

Linux Bash Scripting for Beginners: Write Your Own Scripts

Make your work easier, understand bash scripts written by others and build your own from scratch
4.0 (33 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,441 students enrolled
Created by Andrei Bunghez
Last updated 5/2016
Current price: $10 Original price: $20 Discount: 50% off
1 day left at this price!
30-Day Money-Back Guarantee
  • 2.5 hours on-demand video
  • 1 Article
  • 7 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Have a coupon?
What Will I Learn?
Create and understand bash scripts.
Automate tasks in the Linux environment
Create a simple network monitoring utility in Linux
Schedule tasks to be run on a Linux system by using crontab
Define and use variables and functions in a bash script
Use basic Linux command line tools
Redirect output of command line tools using I/O redirection and pipes
Understand command substitution in the Linux command line environment
Many job ads list shell scripting as one of their requirements. Your chances in landing one of these will significantly increase
View Curriculum
  • You need a linux pc/virtual machine
  • A text editor of your choice. I'm using text mode emacs, but nobody is forcing you to live in the past as well.
  • The bash shell

Have you ever been frustrated by that script that just did not work? Are you tired of searching the web for a ready-made script, hoping that it will fix your problem? Want to sit back and relax for a couple of seconds while your script performs the task that would have taken you two hours to accomplish manually? Then you have come to the right course!

This course will help you build your own scripts and understand the ones written by others. No more relying on scripts that others built and hoping that they will solve your custom problems. Just writing your own solutions to your own problems.

Take this course to get:

  • Learning by example, so that instead of going through boring theoretical concepts, you get to see exactly how each concept applies in practice.
  • Monthly challenges to help you gain experience and trust in your own abilities.
  • Interactive, supportive experience, as I promptly reply to your questions when things just don't work.
  • 30-day money back guarantee if you don't like this course for any reasons, no questions asked.

In short, you will learn the basic building blocks of bash, watch how a real-life utility is built, do the monthly challenges and solve coding problems in the discussion area to gain experience (did I mention the prizes?).

The first section covers basic building blocks that allow you to write your own shell scripts, which are presented in a learn-by-example fashion. Here you will learn about basic linux command line utilities used throughout the course, a simple script structure, defining functions, using input/output redirection, pipes and command substitution. The last lectures in this section focus on control statements, like if, case, while and for.

In the second section I will show you how to build a simple real-life utility for monitoring the amount of traffic on a network interface. There are two scripts involved in this utility. The "core", that queries system data about a network interface and adds it to a comma-separated-values (csv) file, one line at a time. The other one will take care of scheduling the "core" to be run at specific times, based on a user specified interval. The result is a csv file that contains data collected at specific points in time, data that can be later processed into a spreadsheet application (e.g. build graphs from it).

The rest of the course, what I call the dynamic part, is built in time. You will find here lectures on various command line utilities (e.g. find) or more in-depth lectures on subjects like redirection. I also post monthly challenges for you to gain some much needed experience, in order to ascend from a beginner to an intermediate level.


**** Monthly challenges (with prizes) ****

Jun '16: Utility to count the occurrences of a letter inside a text file

Mar '16: Textify, an utility that takes an integer number and converts it to text

Jan '16: Utility to equally space lines in a text file

Dec '15: Host ping reply time monitor


Update History

May 22nd 2016: Published solution for the January challenge

Feb 29th 2016: Published solution for the December challenge

Jan 3rd 2016: New lecture on xargs

Nov 22nd 2015: New section on standard end error output redirection

Nov 15th 2015: New lectures on the find utility and the proc filesystem.

Oct 10th 2015: New quiz on parameters

Who is the target audience?
  • Junior software/network/QA engineers or students who would like to learn to use the linux bash shell efficiently
  • To make best use of this course you should take the time and work on the included challenges and exercises and take advantage from the interaction with your instructor. Just going through the materials can be done for free if you search deep enough.
  • If you are already familiar with bash scripts and linux command line utilities, this course is probably NOT for you
Students Who Viewed This Course Also Viewed
Curriculum For This Course
Expand All 32 Lectures Collapse All 32 Lectures 02:40:24
2 Lectures 03:37

Introductory lecture: find out how this course is structured and who is its intended audience.

Preview 02:00

Brief overview about how this course works and quick glimpse at the Udemy interface.

Preview 01:37
Basic bash Building Blocks
11 Lectures 01:17:49

This lecture briefly describes the utilities used throughout the course and shows you some basic uses.

Preview 06:10

Going over the basic script structure, how to write comments, define and call functions.

Script Structure

This lecture shows you how to define and use variables.

Variables and the Environment

Variables and Expansion
2 questions

Arguments are the way a script receives data from the outside world. This lecture goes over how you can access parameter values and manipulate them.

Script and Function Parameters

A quick quiz on script arguments.

Parameters Quiz
4 questions

This lectures teaches you how to write output to a file, instead of the screen; and how to read input from a file, instead of the keyboard.

Input/Output Redirection

Pipes are a very powerful feature of the shell. This lecture shows you how to use them.

Preview 03:14

The fun part of using bash begins with command substitution. In this lecture you are going to learn how to replace a command name with its output.

Command Substitution

4 questions

This lecture covers the 'if' statement and the syntax of the associated condition.


To avoid using multiple if/else if/else statements, use the 'case' statement, that matches an input expression to one of the given patterns.

Preview 05:51

This lecture covers the while/until loops.


Both forms of the 'for' loops, C-like and lists, are described in this lecture.

The ifMonitor Project - Monitoring a Network Interface
5 Lectures 35:33

This document describes the ifMonitor project goals.

Project Goals

This is the first lecture on the check_iface script, the "core" of the ifMonitor project. This first part shows you how to parse the command line parameters of the script.

The check_iface Script: Extracting the Parameters

In this second lecture on the check_iface script, one line of data is written to the output file.

The check_iface Script: Output Data

cron & crontab are used to schedule tasks at a specified time.

cron & crontab

Using crontab to schedule the check_iface script.

The ifMonitor Script
findutils - find, xargs, locate
4 Lectures 16:47

Short overview on the proc filesystem. We will use files under this folder for the next lectures.

The proc Filesystem

This lecture is about find and gives you an example of how to use it to search for files.


Mysterious if
1 question

Explanation for the question in the previous quiz.

Mystery Explained

You should check the find (man find) documentation for the following quiz

find Some More
3 questions

xargs - an utility that lets you call other commands with parameters determined at runtime (as outputs of other commands)


A few questions on xargs

xargs Quiz
2 questions
[Updated] Cheatsheet
1 Lecture 00:00
Preview 3 pages
More on redirection
2 Lectures 06:19

Find out how to redirect normal output and errors to different files... or even to the same one.

Preview 03:48

Quick question about standard and error output redirection.

Redirecting Output to the Same File
1 question

Standard vs. Error Redirection - part II

Error Redirection
1 question
5 Lectures 03:04

General challenge rules

General Rules
1 page

Build an application that monitors the ping response time of several hosts.

December '15 Challenge - Host Monitor
2 pages

Build a small tool that equally spaces lines in a file.

January '16 Challenge - File Spacer
1 page

Create a script that receives one integer parameter and converts it to text.


  • practice arithmetic expansion
  • practice the case instruction
  • practice the if conditional expression with integers
  • good use of command substitution
  • the use of functions
March '16 Challenge - Textify

Create a simple script that counts the occurrences of a letter inside a text file.

Check the bash manual (man bash) - the Parameter Expansion section - on how to find the length of a variable or how to get a substring (even of length one) from a word.

June '16 Challenge - Letter Counter
[New] Challenge Solutions
2 Lectures 10:15

This lecture will show you how to resolve the host monitor challenge. Besides that, you will take a quick look at getopt, check out a faster way to schedule recurring tasks using crontab and find out how to use the last command error status ($?).

You can download the scripts for this challenge, they are attached to this lecture.

December '15 Challenge Solved

Solving the file spacer challenge. This lecture will give you a quick insight into the workings of the IFS builtin variable.

January '16 Challenge Solved
About the Instructor
Andrei Bunghez
4.2 Average rating
74 Reviews
2,985 Students
2 Courses
Embedded Software Engineer | PM | Android Rookie

Hello! I am a passionate software engineer working mostly in the embedded networking world. I have a degree in Computer Science from the Politechnica University in Bucharest, major in Compilers and Operating Systems and have recently obtained an Android Developer Nanodegree from Udacity.

I have been an embedded software engineer for the past 12+ years, developing and maintaining software for a range of Ethernet devices. During this time I have been responsible for various parts of these systems, ranging from the higher levels of networking protocols like VLAN, STP, SNMP to chip drivers and distributed programming across Ethernet switches. At some point I started leading software releases and did a partial shift to project management, while still maintaining a keen interest in the embedded software practice. In the past few years I have added Android and Arduino on my list of interests and I am now working on a small pet project related to air quality, tying these two platforms together.

I usually prefer learning by example. So, it is only natural that this becomes my preferred way of teaching as well. My lectures are filled with examples that illustrate the main presented concept or topic.

I'm looking forward to seeing you in my courses!