Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Bash Scripting for Beginners: Automate Linux Tasks + Vim
Role Play
Rating: 4.3 out of 5(89 ratings)
11,239 students

Bash Scripting for Beginners: Automate Linux Tasks + Vim

Write Bash scripts with variables, conditions, loops and functions, build admin menus, debug errors and edit fast in Vim
Created byVitalii Shumylo
Last updated 11/2026
English
English [Auto],Japanese [Auto],

What you'll learn

  • Set up a Linux environment and write and run your first Bash scripts
  • Learn Bash syntax, variables, files and permissions
  • Make decisions with the if statement and repeat work with loops
  • Write and reuse functions
  • Handle errors and debug scripts
  • Create scripts that fill a temporary directory, add logging, and clean up temporary files and directories

Coding Exercises

This course includes our updated coding exercises so you can practice your skills as you learn.

See a demo
Image of coding exercise example

Course content

1 section • 50 lectures • 7h 47m total length
  • Setting Up Your Environment. Part 16:15

    Set up your bash environment with a hands-on, step-by-step guide across macOS, Linux, and Windows, including terminal configuration, aliases, and basic navigation.

  • Setting Up Your Environment. Part 210:03

    Learn how to customize the bash prompt by editing the dot bashrc file, exporting PS1, reloading with source, and adding practical aliases for efficiency.

  • Your First Bash Script. Part 111:06

    Write and run your first bash script by creating a file, making it executable, and greeting the user with date and time, while learning the shebang, echo, and command substitution.

  • Your First Bash Script. Part 28:22

    Learn to make your first bash script executable with the change mode command, run it with bash or dot slash, and apply a portable shebang.

  • Bash Syntax Fundamentals. Part 110:41

    Learn bash syntax fundamentals, including variables, data types, command substitution, and quoting. Practice with hands-on examples, functions, and local/global scope to write robust scripts.

  • Bash Syntax Fundamentals. Part 28:11

    Explore bash syntax fundamentals, from treating all data as strings to using variables, arithmetic with dollar double parentheses, arrays with zero-based indices, and command substitution with dollar parentheses and backticks.

  • Bash Syntax Fundamentals. Part 36:27

    Learn bash syntax fundamentals by building a script that uses special variables like $0, $1, $#, and $@, plus variable assignment, command substitution, and exit status.

  • Working with Files and Permissions. Part 112:54

    Master navigating and manipulating the unix-like file system with bash by using pwd, ls, cd, mkdir, touch, cp, mv, and rm to manage files, directories, and permissions.

  • Working with Files and Permissions. Part 24:44

    Learn how unix-like file permissions govern read, write, and execute access for owner, group, and others, and master symbolic and numeric chmod methods.

  • Working with Files and Permissions. Part 310:32

    Create a bash script to set up a project directory structure with source, docs, and tests, add main.py and readme.md, set permissions 755 and 644, and verify with recursive listing.

  • Script Example: File Operations and Bash Concepts13:18

    Explore advanced bash concepts by enhancing a file operations script with special variables, command substitution, user input, timestamps, and file permissions, plus modifying configuration files.

  • Quiz: First Scripts, Variables, Arrays and Command Substitution
  • 'if' Statement. Part 17:59

    Explore bash conditional statements and if statements, including elif and and/or operators, with practical scripts that check file existence, compare numbers, and build a simple checker.

  • 'if' Statement. Part 212:14

    Master bash condition testing with file checks (-f, -d, -r), string checks (-z, -n), and numeric tests (-eq, -ne, -lt, -gt), and combine with && and || in if statements.

  • Loops in Bash. Part 18:33

    Master bash loops, including for, while, and until loops, with examples that count, iterate lists, process files, and use break and continue for efficient automation.

  • Loops in Bash. Part 210:23

    Explore the until loop in bash, its structure, and how it differs from while; learn to use break, continue, and nested loops, plus a practical file-processing example.

  • Hands-on Lab: Interactive Menu Script. Part 19:23

    Join a hands-on lab to build an interactive bash menu script for Linux system administration, featuring a looping menu, case-based actions, and enhancements like screen clearing.

  • Hands-on Lab: Interactive Menu Script. Part 211:23

    Build an interactive bash script with a menu, a guess-the-number game, and commands like clear screen, random, and case statements; debug, format, and extend with ANSI color options.

  • Hands-on Lab: Linux Administration Interactive Menu Script. Part 19:47

    Build a bash, menu-driven Linux system administration script that runs uptime, disk usage, top CPU processes, memory checks, and logs, with enhancements to system load and large-file search.

  • Hands-on Lab Linux Administration Interactive Menu Script. Part 28:19

    Learn to build a Linux system administration menu in Bash, implement case statements, read user input, and troubleshoot options while exploring common admin tasks.

  • Quiz: Tests, Loops and Admin Menu Scripts
  • Functions in Bash. Part 110:35

    Learn bash functions as building blocks, defining and calling them, passing parameters, returning values, using local variables, with practical examples like greeting, calculations, and a number guessing game.

  • Functions in Bash. Part 211:52

    Explore how bash functions use local variables to prevent global side effects, create reusable code blocks, and build practical examples for checking even/odd numbers and generating random numbers.

  • Error Handling and Debugging in Bash. Part 18:55

    Master bash error handling and debugging to build robust scripts. Learn exit status checks, traps and custom functions, and use verbose debugging to diagnose and prevent cascading failures.

  • Error Handling and Debugging in Bash. Part 211:40

    Learn practical error handling and debugging in Bash scripts, including exit on failure with set -e, custom error functions, and trap based cleanup to ensure reliable script execution.

  • Error Handling and Debugging in Bash. Part 310:58

    master bash script debugging by enabling set -x for verbose output, inserting debug echoes, implementing an error handler and trap-based cleanup, and using bash db for step-by-step debugging.

  • Advanced Bash Scripting Techniques - Examples Explained. Part 19:53

    Explore advanced bash scripting techniques with practical examples of parameter expansion, indirect reference, associative arrays, process substitution, brace expansion, and complex input/output redirection.

  • Bash Parameter Expansion: Predict What the Shell Prints
  • Advanced Bash Scripting Techniques - Examples Explained. Part 210:05

    Master advanced bash scripting techniques, including indirect references, associative arrays, and array operations. Explore array slicing, process substitution, and brace expansion with practical examples.

  • Advanced Bash Scripting Techniques - Examples Explained. Part 313:45

    Explore advanced Bash scripting techniques with practical examples: input/output redirection, here documents, subshells and command grouping, traps and signals, recursive functions, and parsing command line options with getopts.

  • Advanced Bash Scripting Techniques - Practical Example Walkthrough9:29

    Explore advanced bash scripting techniques through a practical walkthrough of a script using declare, associative arrays, a recursive traverse function, and a trap for cleanup to count file extensions.

  • Bash Script Optimization and Performance. Part 18:56

    Master bash script optimization and performance by leveraging built-in commands, avoiding unnecessary commands, using shell arithmetic, double brackets, and brace grouping for faster, leaner scripts.

  • Bash Script Optimization and Performance. Part 210:20

    Learn bash script optimization and performance techniques, replacing multiple variables with arrays, using read with here strings, and leveraging awk, sort, grep, and parallel processing for large data sets.

  • Bash Script Optimization and Performance. Part 38:54

    Profile your Bash scripts with the time command to pinpoint bottlenecks, then enable set -x to trace execution. Demonstrate optimization using printf, shell arithmetic, awk, grep, and sort.

  • Bash Script Optimization and Performance. Part 49:26

    Improve bash script performance by debugging typos, and creating scripts to generate data.csv, large_underscore_file.txt, and names.txt for practice.

  • Bash Script Optimization and Performance. Practical Example Walkthrough6:31

    Apply bash script optimization techniques to generate data.csv, large_file.txt, and names.txt, then run the main optimization script. Learn troubleshooting, measure performance before and after, and prioritize readability over minor gains.

  • The Nightly Script Said Nothing and the Backup Is Missing
  • Quiz: Functions, Error Handling, Advanced Techniques and Debugging
  • Write a Safe Backup Script: Arguments, Functions, Errors and Rotation
  • Getting Started with Vim Basics12:42

    Learn vim basics: switch between insert and normal modes, navigate with h j k l and word commands, search, replace, undo, redo, and use visual mode for text selection.

  • Introduction to Basic Navigation in Vim14:36

    Learn Vim basics by switching between normal and insert modes and navigating with h, j, k, l and numeric multipliers, then master word and paragraph movement, search, and save commands.

  • Hands-on Practice: Vim Installation and Basic Navigation5:20

    Install vim on Ubuntu, macOS, or Windows, then practice basic navigation in vim using h, j, k, l, w, b, 0, and $ while entering insert mode.

  • Introduction to Basic Navigation in Vim14:23

    Learn basic Vim navigation and editing commands to move, search highlights, copy and paste lines, delete text, and insert or append new content.

  • Basic Vim Navigation4:21

    Practice vim navigation through hands-on exercises, including creating a file with touch, using insert mode to paste text, and jumping between paragraphs and lines with gg, G, 0, and $.

  • Advanced Vim Navigation7:07

    Practice advanced vim navigation and editing, locating all Python occurrences, jumping through search results, deleting words and lines, undoing and redoing changes, and adding new lines.

  • Vim Search and Replace5:40

    Master vim search and replace, copy and insert text, and perform global line-range substitutions to boost text editing efficiency.

  • Vim Copy and Insert8:21

    Master vim copy and insert techniques by y, yy, w, p, and P, performing word and line pastes, undos, and edits, including reading text from files with :read.

  • Vim Fundamentals: A Comprehensive Review of Core Concepts and Commands5:45

    Master Vim's modal editing, switching between normal and insert modes for navigation, text changes, yanking, deleting, search and replace with / and ?, and repeating edits with the dot command.

  • Overview of Exercise Lessons. What will we learn?3:52

    Master Vim basics and advanced text editing, from creating and opening files to navigation, deletion, copying, pasting, and undoing changes. Practice visual mode, word changes, substitutions, and multi-window workflows.

  • Exercise 1: Editing in Vim9:43

    Practice text editing in vim through file creation, insert mode, deletion and undo, and word and block commands like cw, ciw, and visual block editing.

  • Exercise 2: Editing in Vim7:47

    Master Vim editing to rearrange scripting languages sections, delete and insert text, and perform multi-block edits using search, visual selection, and the global command.

  • Exercise 3: Editing in Vim11:26

    Practice editing in vim by deleting lines, performing substitutions from scripting to programming, indenting bullets, copying non-contiguous lines, changing inside parentheses, and yanking and pasting across a document.

  • Exercise 4: Editing in Vim13:20

    Demonstrate advanced Vim editing techniques: open at specific lines, jump to end, navigate multi-window mode, use dot to repeat changes, and perform save, search, and copy operations.

  • Navigating and Editing Multiple Files in Vim7:31

    Navigate and edit multiple files in Vim across windows, buffers, and splits, using commands like next, previous, added, split, close, and save with wq for all buffers.

  • Advanced Vim Techniques for Managing Multiple Files13:08

    Explore advanced vim techniques for managing multiple files, including diff mode and diff split, opening buffers, and using bufdo to apply substitutions across all config files.

  • Practice Test: Bash Scripting for DevOps
  • Bonus Lecture: What to Learn Next0:18

Requirements

  • A wish to learn Bash scripting
  • A Linux machine or virtual machine

Description

Bash is the language every Linux server already speaks. This course takes you from your very first script to scripts that do real administration work, and it finishes with Vim so you can write and fix those scripts on a server that has no graphical editor.

What the lectures cover

Besides the main topics, you also work through: Build an interactive menu script, then a Linux administration menu that runs everyday tasks; Edit fast in Vim: navigation, search and replace, copy and insert, and working with several files; Practise with four Vim editing exercises.

Inside the course

The course is organised into these sections: Scripting with Bash Complete Course; Automation Bash Scripts Examples; Vim Basics; Even more on Vim Editor. Lectures you will find include: Setting Up Your Environment; Your First Bash Script; Bash Syntax Fundamentals; Working with Files and Permissions; Script Example: File Operations and Bash Concepts; Loops in Bash; Hands-on Lab: Interactive Menu Script; Hands-on Lab: Linux Administration Interactive Menu Script; Hands-on Lab Linux Administration Interactive Menu Script; Functions in Bash; Error Handling and Debugging in Bash; Advanced Bash Scripting Techniques - Examples Explained; Advanced Bash Scripting Techniques - Practical Example Walkthrough; Bash Script Optimization and Performance; Bash Script Optimization and Performance. Practical Example Walkthrough; Script to Populate Temporary Directory; Script to Populate Temporary Directory. Adding logging; Script to Clean Up Temporary Files and Directories; Getting Started with Vim Basics; Introduction to Basic Navigation in Vim; Hands-on Practice: Vim Installation and Basic Navigation; Basic Vim Navigation; Advanced Vim Navigation; Vim Search and Replace; Vim Copy and Insert; Vim Fundamentals: A Comprehensive Review of Core Concepts and Commands; Overview of Exercise Lessons. What will we learn?; Exercise 1: Editing in Vim; Exercise 2: Editing in Vim; Exercise 3: Editing in Vim; Exercise 4: Editing in Vim; Navigating and Editing Multiple Files in Vim; Advanced Vim Techniques for Managing Multiple Files.

The course runs about 7.8 hours in 50 lectures and includes one practice test with 40 questions. It is focused on Bash scripting and Vim. It does not cover other languages or a full DevOps toolchain. Expect to type along, to pause often and to repeat each script on your own machine until it runs the way you want. The practice test helps you check what you have learned.

Who this course is for:

  • Beginners who want a first step towards automation
  • System administrators who still repeat tasks by hand
  • DevOps technicians who need scripts for daily work
  • IT specialists who must edit files on servers without a graphical editor
  • Students of Linux who want practice with scripts