
Learn how the pwd command prints the current working directory in bash, with practical examples from home, music, and ben directories to show absolute paths.
Master the cd command to navigate directories using absolute and relative paths, the home shortcut (~), and cd - and cd .. to move back or up.
Master the ls command to view directory contents in the terminal, using -l for long listings, -a for hidden files, and -t to sort by modification time, with manual help.
Learn to use grep to search files for patterns, pipe results with commands, and apply options such as -o, -c, -v, -A and -B with regular expressions and colored output.
Learn what a script is: a sequence of commands stored in a file, with loops and arguments, and how to create, set permissions, and run it in the terminal.
Learn to craft robust shell scripts by understanding the shebang, choosing /bin/bash interpreters, setting executable permissions, and ensuring cross-machine compatibility.
Learn to perform math in Linux bash scripts using bc and double parentheses, with variables, plus, plus equals, and dollar sign conventions, and how to pipe expressions to bc.
Discover how IFS and the shell's field separator affect argument handling, assign first and second script arguments to variables, and compute their sum while displaying arguments with a comma.
Redirect standard output and standard error to separate or combined files, then use piping to pass command output through filters like cat, wc, and head.
Explore Bash string comparison with single and double brackets, quoting, and space sensitivity, learning how to test for equal or not equal and identify root user status.
Explore how wildcards enable pattern matching for files and strings, using symbols like question mark, asterisk, square brackets, and negation for flexible filtering and comparisons.
Create a bash backup script using wildcards to copy all ptf files from a source to a timestamped backup directory, with argument validation and date-based folder creation.
Master regular expressions in Bash, covering pattern matching, anchors, quantifiers, square brackets and escapes, for validating emails and IP addresses in scripts.
Interested what [ -f $FILENAME ], [ -d $PATH ] and other filesystem comparisons can do?
for loop theory
From real world: for what purpose we use for loop
loop through all script arguments using for arg in "$@" to handle each argument separately, and contrast with "$*" that joins all arguments.
Explore how to construct and use while loops in bash, test conditions at the top with brackets or double parentheses, and read files line by line via redirection or pipes.
Build a bash script that mimics cat with line numbers, accepting one file argument, printing each line with a number, and reporting if the file doesn't exist.
Explore using getopts to parse positional parameters A and B with required arguments and C and D without arguments, demonstrating case statements and automatic dash handling in bash scripts.
Declare arrays with parentheses, assign elements, access them using a dollar sign and curly braces; show items with *, list indexes with !, and count with #.
Learn how awk reports the number of fields per line using NF, indices like $F, and arithmetic to display or compute field counts in space-delimited input.
Learn the for loop structure in shell scripting, including initialization, condition testing with i <= 10, and incrementing, then print each field and value for every record.
Build a bash script named files with awk to count files in the directory, report disk usage, filter by extension, and identify largest and smallest files, using sed.
Create a bash script that uses a lockset variable to detect if a location is set, defaults to the current directory, and prints the location with command substitution.
apply an awk script to count and report the total size, largest, and smallest files of a given extension in a directory, displaying results in megabytes and file counts.
Use the print command to display lines that match a pattern, suppress default printing with -n, and apply ranges and the last line reference for precise file output.
Learn how to use sed to append or prepend text to specific lines, match lines by a pattern, insert before lines, and add text at the first line.
Learn how the delete command (d) uses regular expressions and line addressing to remove lines containing a pattern from text tables, with examples converting names to uppercase.
Learn how to use the q quit command in bash scripting to search with regular expressions, control exit status, and selectively print lines from an input file.
Explain how the substitute command uses s with regular expressions and replacement, showing first-match default behavior and global replacement with g, with examples masking numbers in echo output.
Explore sed's substitute command, using s/old/new/ to replace text, apply line ranges (1,$), perform in-place edits with -i, and reuse the matched text with &.
Develop and test a sed-based script that fixes spaces and tabs at the start and end of lines, controlled by a fix parameter and applied to a provided file.
Explore a sed-based script that reads files line by line, detects leading or trailing spaces and tabs, and prints clean lines while exiting on issues.
Learn to write a sed script that highlights leading spaces and tabs with a red background, detects lines with spacing issues using extended regular expressions, and prints their line numbers.
Explore a sed-based script that reveals spaces and tabs at line ends, trims leading and trailing whitespace, and outputs cleaned lines for verification in a bash scripting workflow.
Learn how to tidy sed scripts by fixing trailing space issues, control newline output with echo, and add conditional messages with a green background to indicate fixes.
Welcome to linux bash shell scripting course. I'am Richard and I will be your instructor. I have great knowleadge about shell scripting as throughout my carrer I had been working for Fortune 50 company, where I apart from taking care of 200+ Solaris servers wrote many scripts for keeping live easy :)
What is covered?
Basics of scripting - no worry you don't know anything about scripting by now
Sha-bang explanation - what it is and why the heck it is called sha-bang
Decision making
Regular expressions
Wildcards
For & While loops
Functions
Reading arguments using CASE structure
Getopt
Getopts
...and many more
And what about AWK? Yes, it is covered here! And what about SED? Also covered!
Why I have created this course?
Many years back, when I was starting as UNIX administrator, I had many ideas how to improve specific things using scripts. But, I couldn't find any good resource, which would take me through all needed topic in one place. Somewhere I got great explanation about sha-bang while regular expressions for shell scripting were only mentioned. Somewhere was good explanation about decision making in if statement, but SED and AWK part was missing, and that use of SED and AWK was in my carrer really important. Basically I cannot imagine any single production script, where I wouldn't used SED or AWK, because without them you are not able to create that "magic" in your script.
Many years later, I am here to share in one place what is really needed in order to create magic script. Not only how to create script, do some decision making in if statements, write functions, use arrays, but mainly how to combine everything including AWK and SED. I was creating this course in a way, which would help me a lot to create great scripts during start of my career. All needed things in one place.
Please, watch my preview lectures to see what we are going to build in this course.