Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Linux Bash Scripting
Rating: 4.4 out of 5(485 ratings)
33,835 students

Linux Bash Scripting

Start with Bash scripting and Automate Tasks
Created byPeter A
Last updated 3/2019
English
English [Auto],

What you'll learn

  • Linux users that want to start Bash scripting
  • Any Linux user

Course content

1 section12 lectures32m total length
  • Intro2:04

    Write a bash shell script as a plain text file ending with .sh, add a shebang to set the interpreter, then chmod +x and run with ./script.sh.

  • First Script1:39

    Create and run a simple bash script by writing a two-line file, saving it as myscript.sh, making it executable, and printing a hello world message.

  • Keyboard Input2:08

    Learn to read user input in a bash script using read name and display 'your name is $name'. Create name.sh, make it executable, and run to see the input.

  • Shell Menu1:43

    Create a shell menu script that prompts user input to choose a color from a list, stores the selection in a variable, makes it executable, and displays the chosen color.

  • For Loop3:06

    Explore for loops in Linux Bash scripting by looping over names, files, and numbers with echo, then run the script to see repeated commands and file listings.

  • If Statements1:19

    Explore conditional execution in bash using an if statement that checks a user input guess against 6, executing commands when true and guiding responses for other choices.

  • Lists2:18

    Define and loop over a shell list, printing each item with a color variable, and access specific elements by zero-based index; use dash comments to ignore lines.

  • Strings1:55

    Learn to define and manipulate strings in bash, output hello world, and create new strings by slicing from index 0 to 5 or 5 to 7.

  • Functions5:31

    Define and call bash functions, pass parameters using $1 and $2, and distinguish local versus global variables to manage scope and reusable function output.

  • Files4:37

    Learn to read and write files in bash scripts by using echo, redirection, and making them executable; control file contents with conditional if exists and finish statements.

  • Save Command Output to File1:52

    Save command outputs to a file from the terminal, creating outputs60 and storing results there; inspect the file to verify outputs, and apply to any command, including date or ifconfig.

  • Stdout Tricks4:35

    Capture a program’s standard output into a variable, echo it, and filter results with grep and pipes; subset selections include network connections, dates, and file contents via command substitution.

Requirements

  • No prequisities, except access to a Linux computer

Description

This course is an introduction to Bash scripting.

You will learn the beginners concepts and be able to make your own bash scripts. This will make your life easier, as you won't have to type each command manually but instead run scripts. We'll go over file scripts, loops, if statements and many other scripting concepts.


Why Linux Bash Scripting?

Bash scripting is a very powerful tool in the hands of a Linux administrator. It is capable of doing everything similar to Windows batch file, but with more ease. Many system administrators are not familiar with Linux Bash scripting and thus do not find it useful. It is my opinion that any Linux sysadmin worth his or her salt, should learn how to use Bash scripting as soon as possible in order to automate their daily tasks.

There are a few reasons why Linux Bash scripting is so powerful. One reason is that it is very easy to use. Unlike Windows batch files, which can be quite complex and difficult to understand, Bash scripts are much simpler and easier to read. This makes them perfect for automating tasks that would otherwise be tedious and time-consuming.

Another reason why Linux Bash scripting is so useful is because it is extremely versatile. It can be used for a wide range of tasks, from simple file management to complex system administration. In addition, Bash scripts can be easily modified and customized to meet the specific needs of any user or organization.

Finally, Linux Bash scripting is very popular among experienced Linux users and administrators. This popularity means that there is a large community of users who are familiar with the script and who can offer support and advice when needed.

Who this course is for:

  • Beginner Linux users
  • System administrators