Linux Shell Script

  • Home
  • /
  • Linux Shell Script

Linux Shell Script

  • Overview
  • Syllabus
  • Project
  • Interview Questions

Want to feel like an awesome spy hacker similar to the one in the movies that opens a command line terminal and manages to complete complicated tasks using a few simple codes? Well, this can be a reality using BASH.
A huge chunk of a programmer’s time is wasted in trying to repeat codes and processes, especially when it comes to working with UNIX or Linux. The constant commands that are required to program or create systems is a tedious and long process.
Well, here’s how you can eliminate that and save a whole buncha time – BASH
Bourne Again Shell, more popularly known as BASH is a UNIX/Linux shell and a command line interpreter that runs commands from a standard input file. This shell comes with a nifty feature that allows you to reduce the amount of commands that you have to call personally by automating them.
Our Shell Scripting course has been specifically designed to teach you how to use BASH to shave hours from your coding practice. Learn how to write shell scripts, learn how command history, echo command and even variables work, along with how to automate simple and complex commands. This BASH tutorial doesn’t even require you to have previously worked with BASH. All it needs is for you to be familiar with UNIX or Linux and have a machine that runs UNIX or Linux – that’s it! That’s all you need to be on your way to learning automation.
The course starts at the very beginning including what is BASH, what are shells, what do you  mean by shell scripts, customizing your shell, difference between a shell script and an interactive shell, command line-options, statements, loops and so much more.
In addition to providing you with theoretic information about BASH and Shell Scripting, the course will also give numerous examples at every step to get you familiar with how scripting works and what happens when you execute a certain script. Additionally, you will also be provided with all the scripts that were used by the instructor to try on your own.
Learn how to write well documented, modular, efficient and complex shell scripts, automate daily routines, basic programming concepts such as loops, commands and statements, how to effectively write command line processing, process management and even manipulate command-line functions.

Syllabus

    Shell  Scripting

    1. Introduction of UNIX

    3. Understanding Advance commands.

    5. User environment  variables

    7. Scheduling and automating scripts.

    9. Understanding Shell operators.

    11. The shift command

    13. Using break, continue, exit, and return

    15. Here Document

    17. Ways to Process a File Line-by-Line

    19. Automating day by day manual tasks 

    21. Practicing Example scripts.

    2. Understanding Basic shell commands 
    4.
    Advance sed and awk , find
    6. Understanding file permissions
    8.  Types of variables and variable declaration 
    10. Command line arguments.
    12. Control
    Structures 

    if ... then statement 

    if ... then ... else statement 

    if ... then ... elif ... (else) statement 

    for ... in statement 

    while statement 

    until statement 

    case statement

    14. Writing functions 
    16. Automated Event Notification.
    18. Automated
    ftp stuff
    20. Automated  Monitoring  stuff

Shell scripting Project

In this project, you will construct scripts to do the following:
  • gordo: Find the five folders in the current directory consuming the most space.
  • mp3dups: Report duplicate MP3s (by file contents, not file name) on a computer.
  • recap: Take a list of names whose first and last names have been lower-cased, and properly recapitalize them.
  • oxbane: Find all words in English that have x as their second letter, and n as their second-to-last.
  • rot13: Apply rot13 encoding/decoding to standard in.
  • space-invader: Replace all spaces in a filename with underscore for a given directory.
  • intersect: Computes the lines common to two files.
  • crackgen: Generates a password hash file from a dictionary.
  • passcrack: Attempts to crack a password database whose passwords were hashed but not salted using the output of the previous program.
  • validate: Validates a username and password against a database whose passwords have been properly salted and hashed.
  • Recommended tools: bash or zsh, md5sum, diff, sort, uniq, cut, sed, awk, du.

Testing

Running make test will run all of your scripts against the supplied test inputs in the data directory. The results will be dumped into the results directory for inspection.
Running make compare will diff the results directory with the supplied expected-results directory, which contains the output of the tools when run against the provided test inputs in the data directory.

Requirements

Complete each of the scripts in the ./scripts directory according to the specification in the comments.
You can use any programming language you want that exists on the server, as long as the script has the desired behavior when executed.