Shell Scripting: The Bad Tutorials
Video Lectures
Displaying all 62 video lectures.
Lecture 1![]() Play Video |
Introduction This is the first tutorial in this series. Learn about the prerequisites that must be met before beginning the course. |
Lecture 2![]() Play Video |
Shell, Kernel, Terminal & More Next in the series: http://youtu.be/ThQ6R1EM0e8 In this tutorial you'll find information on the significance of shell scripting. You'll gather definitions of shell, kernel and terminal and you'll learn how to execute commands at the terminal. 'who' and 'pwd' are discussed at the end of the tutorial. |
Lecture 3![]() Play Video |
View System Date, Calender Next in the series: http://youtu.be/0csDVuBloIQ 'cal' and 'date' are handy utilities to check out system date and time and also to view dates from past and future. Try running 'cal' for September 1752, you'll be amazed to see the output. |
Lecture 4![]() Play Video |
Create Files & Directories In this tutorial you'll learn to use 'touch' and 'mkdir' to create files and directories respectively. You'll also learn to use 'cd' to change your working directory in the terminal. |
Lecture 5![]() Play Video |
Text Files: Create, Merge & Play In this tutorial you will learn to create text files through the terminal using the 'cat' command. 'cat' is an extremely important command and we'll be using it a lot in the course. I have discussed a few applications of the command here, will be checking it out again in future. |
Lecture 6![]() Play Video |
Rename & Delete Files & Directories In this tutorial you'll learn to rename files using 'mv' command and you'll also learn to delete files and directories using 'rm' and 'rmdir' |
Lecture 7![]() Play Video |
Create Copies, Links to Files & Directories In this tutorial you'll learn to create copies of files and directories using 'cp' and also to create soft and hard links to files using 'ln' command. |
Lecture 8![]() Play Video |
File Permissions In this tutorial you'll learn about file permissions and the system variable 'umask' |
Lecture 9![]() Play Video |
See What's In Using 'ls' In this tutorial you'll learn to use 'ls' command to see contents of directories. 'ls' is a very powerful utility and comes with more than a dozen options, we'll discuss it in even greater detail in later parts of the course. |
Lecture 10![]() Play Video |
Change File Permissions Using 'chmod' In this tutorial you'll learn to change file permissions using 'chmod'. You'll understand the significance of permissions for directories and you'll also learn to use 'uname' to view information about your system. |
Lecture 11![]() Play Video |
Count Lines, Words & Characters Using 'wc' In this tutorial you'll learn to execute the 'file' command to see contents of folders, and also to count the number of lines, words and characters in text files using 'wc'. |
Lecture 12![]() Play Video |
Sort In this tutorial you'll learn to sort text from text files using the 'sort' command. |
Lecture 13![]() Play Video |
Cut Through Your Files In this tutorial you'll learn to use the 'cut' command to extract data from your text files. |
Lecture 14![]() Play Video |
Convert & Copy Files With 'dd' 'dd' can be used to change case of characters in a text file, to change the character encoding in text files and for a lot more cool things. In this tutorial you'll learn to use it. |
Lecture 15![]() Play Video |
Get Help, View Fancy Text & Reduce File Size In this tutorial you'll learn to use 'man' to get information about commands, 'banner' to generate fancy text and 'compress' to reduce size of a text file. |
Lecture 16![]() Play Video |
Hello World! In this tutorial you'll learn to create and execute a shell script. You'll learn to include comments in script files and display "Hello World" in the terminal using the 'echo' command. |
Lecture 17![]() Play Video |
Use Commands In Your Scripts In this tutorial you'll learn to prepare a shell script with a bunch of commands. |
Lecture 18![]() Play Video |
Shell Variables, Grab User Input Using 'read' In this tutorial you'll learn to use shell variables in your scripts. You'll also learn to take input from user during the execution of a shell script at the terminal using 'read' |
Lecture 19![]() Play Video |
Positional Parameters In this tutorial you'll learn to use command line arguments in your scripts through positional parameters. |
Lecture 20![]() Play Video |
More On Positional Parameters In this tutorial we'll discuss positional parameters in greater detail, we'll also check out the 'set' command and see how it can help us assign values to our positional parameters. |
Lecture 21![]() Play Video |
Reverse Quotes Or Accent Graves In this tutorial you'll learn to instruct the shell to interpret commands within commands using reverse quotes. |
Lecture 22![]() Play Video |
Count The Number of Command Line Arguments Using $# In this tutorial you'll learn to find the number of positional parameters set either through the 'set' command or through the command line arguments, using system variable $#. |
Lecture 23![]() Play Video |
Math On Integers Using 'expr' In this tutorial you'll learn to perform arithmetic operations on integers using 'expr' |
Lecture 24![]() Play Video |
Operator Precedence In this tutorial you'll learn to evaluate arithmetic expressions against the regular rules of precedence using parentheses. |
Lecture 25![]() Play Video |
Math On Real Numbers In this tutorial you'll learn to perform arithmetic operations on real numbers using 'bc' |
Lecture 26![]() Play Video |
Escape Sequences In this tutorial you'll learn to use escape sequences with 'echo' to modify its behavior. |
Lecture 27![]() Play Video |
Do Cool Things With 'tput' In this tutorial you'll learn to use the 'tput' command to change text-display settings, position the cursor at any location on the terminal and to determine the number of rows and columns in your terminal. |
Lecture 28![]() Play Video |
'if-then' Statement in Action In this tutorial you'll learn to use the 'if-then' statement to make decisions in shell programs. |
Lecture 29![]() Play Video |
: The 'if-then-else' Statement In this tutorial you'll learn to use the 'if-then-else' statement to make decisions for you. The script made in the previous tutorial is extended to display an error message in the event of failure of the rename command. |
Lecture 30![]() Play Video |
Run Checks on Numbers In this tutorial you'll learn to compare numbers by placing test conditions within square brackets. |
Lecture 31![]() Play Video |
Run Checks On Files In this tutorial you'll learn to check files by placing test conditions within square brackets. |
Lecture 32![]() Play Video |
Append Text to a File Through Shell Script In this tutorial you'll learn to use the nested if-else construct and append text to a file using the 'cat' command. |
Lecture 33![]() Play Video |
Run Checks On Strings In this tutorial you'll learn to compare string variables and also to determine whether a string variable is of length zero or not. |
Lecture 34![]() Play Video |
The 'AND' Logical Operator In this tutorial you'll learn to use the '-a' operator as a logical connective between test conditions. |
Lecture 35![]() Play Video |
Count The Number of Characters in User's Input in Your Script In this tutorial you'll learn a method to check if a single character has been provided as input to a variable in a shell script or more than one characters have been provided. We will use this method to build the script in the next tutorial. Tutorial on 'wc': http://www.youtube.com/watch?v=Ex-mzjPwrmo |
Lecture 36![]() Play Video |
The 'OR' Logical Operator In this tutorial you'll learn to use the '-o' logical connective between test conditions in shell scripts. |
Lecture 37![]() Play Video |
The 'case' Statement In this tutorial you'll learn to use the 'case' statement to make decisions. 'case' can sometimes be a better option than the other selection statements such as 'if-else', particularly when the input or decision variable in the script can take any value from a large range of values. |
Lecture 38![]() Play Video |
Another Date With 'case' Statement Alright, this one is for those who weren't satisfied with the last tutorial. I hope I manage to get things through in this tutorial. |
Lecture 39![]() Play Video |
The 'while' Loop In this tutorial we'll learn to use the while loop to display ten numbers on screen. The 'while' loop is my favorite loop and I am sure you will be able to appreciate it's usefulness as well as we move along. |
Lecture 40![]() Play Video |
The 'until' Loop In this tutorial you'll lean to use the until loop which I like to refer as while's baby brother. Though I always choose while whenever I have to make a choice between while and until, until has it's own advantages and at times you will find yourself using it over while for convenience sake. So, make a not of it's syntax and you'll be good to proceed. |
Lecture 41![]() Play Video |
The 'for' Loop In this tutorial you'll learn to use the for loop to display names of directory files existing in your home folder, on the terminal using for loop. The for loop is an excellent construct and quite often the first choice in cases where it is not known in advance how many iterations the loop is supposed to perform. |
Lecture 42![]() Play Video |
Rant & Little Work Link to Tutorial-30: http://www.youtube.com/watch?v=YhtHm9gyMxE In this tutorial you'll learn to use the '=' operator while comparing two floats. The -eq operator does a good job with integers but it doesn't quite work with real numbers. Thanks for watching! |
Lecture 43![]() Play Video |
Search Patterns Using 'grep' In this tutorial you'll learn to use 'grep' to find patterns in text files. 'grep' is a really important command and I am surprised why I didn't discuss it earlier in the course. Anyway, I hope you guys like the tutorial. We have forty three tutorials in the course and still there is so much more to discuss. That attests to my slow speed and shell's power and extent. I'll try to pick some speed and make the course more interesting for us all. Thanks for watching! See you in the next tutorial. |
Lecture 44![]() Play Video |
The 'passwd' File Explained In this tutorial you'll find information on the passwd file in the 'etc' folder in the file system. The 'passwd' file contains useful information about all the system and user accounts and understanding its content is important for us to proceed in the course. |
Lecture 45![]() Play Video |
The Internal Field Separator In this tutorial we'll try to understand the significance of IFS by seeing its impact on the behavior of the 'set' command. |
Lecture 46![]() Play Video |
'passwd' File Revisited In this tutorial you'll learn to search a pattern in the '/etc/passwd' file after changing the value of IFS. The script displays information about a user whose username is provided as an input. |
Lecture 47![]() Play Video |
Reading From a File In this tutorial you'll learn to use the exec command to change the default input stream from the keyboard to a text file. We'll also build a shell script that will display line numbers along with the sentences in a text file on screen. |
Lecture 48![]() Play Video |
Sleep while you are at work In this tutorial you'll learn to use 'sleep' to cause delays in your shell scripts. |
Lecture 49![]() Play Video |
Count the number of words & sentences in a text file without using 'wc' In this tutorial you'll learn to count the number of words and sentences in a text file by switching the input stream to the text file and then using 'for loop' construct to iterate over the sentences in the file. |
Lecture 50![]() Play Video |
Fetch & Redirect Man Pages of commands using 'for loop' In this tutorial you'll learn to iterate over contents of a text file using for loop. |
Lecture 51![]() Play Video |
Nested Loops In this tutorial you'll learn to use nested loops to print all possible combinations of digits 1, 2 and 3. I was asked to write this program in an exam I wrote in the second year of my graduation. I remember using three 'for loops' then. I got back home and immediately tested the code I wrote in the answer sheet and when I saw the twenty seven numbers on screen, I realized that I wasn't as dumb as I thought myself to be. |
Lecture 52![]() Play Video |
The 'break' Statement In this tutorial you'll learn to use the break statement to transfer control from within the loop to the first statement after the loop. |
Lecture 53![]() Play Video |
The 'continue' Statement In this tutorial you'll learn to use the 'continue' statement to skip iterations in loops. |
Lecture 54![]() Play Video |
More on Metacharacters In this tutorial you'll learn to execute multiple commands on a single line in the terminal without using a shell script. |
Lecture 55![]() Play Video |
Adding & Removing Users In this tutorial you'll learn to add or remove users on the system, also we'll check out the 'login' command to login through a user account in a terminal window. |
Lecture 56![]() Play Video |
Know when users log in Part One In this tutorial we'll build a script that checks for a user every minute and then notifies us when it logs in and also displays the time the user was late in logging in. |
Lecture 57![]() Play Video |
: Know when users log in Part Two In this tutorial we'll improve the script we built in the previous lesson. |
Lecture 58![]() Play Video |
Know when users log in Final Part In this tutorial we'll finish our work on the script we first met in the 56th tutorial. We'll check every one second for the user and will also report time with greater precision. |
Lecture 59![]() Play Video |
Communicate with other users using 'write' In this tutorial you'll learn to send messages to other users on your system using the 'write' command. You'll also learn to use 'finger' command to see which users who have disabled message reception and which have not. |
Lecture 60![]() Play Video |
Create Your Own Commands Using Functions In this tutorial you'll learn to create your own commands using functions. |
Lecture 61![]() Play Video |
Executing Multiple Scripts In this tutorial we'll learn to execute a script from another script; not a particularly hard thing to do but I recorded a tutorial on it anyway. |
Lecture 62![]() Play Video |
Conclusion Thank you so much for watching the tutorials in this course. I hope you guys had as much fun watching the tutorials as I had recording them for you. |