SHELL SCRIPTING

First of all, Thank you Preeti Mam for arranging such a great 2-day workshop as always and Vimal Daga sir for conducting such a great workshop. It was very informative and got to learn various new concepts.

DAY 1

  • > Shell script can be defined as the list of commands that we want to execute using UNIX shell.
  • > There are 2 types of System interfaces:- i) CLI(Command Line Interface) ii) GUI (Graphical User Interface).
  • > Shell can be defined as the program running on our OS on top of which we can execute various commands.
  • > Bash Shell(Bourne Again Shell) is the most used Unix Shell.
  • > Variables store the address of the value which is stored somewhere on the memory. Types of variables are:- i) Pre-defined variables ii) User-defined variables iii) Environmental (Shell variables).
  • > Exit code tells us whether the command that we have executed run successfully or not.
  • > Command can be defined as a single program of instruction that we can execute once at a time but Script consists of list commands that we want to execute one after another.
  • > We use hashbang /shebang (#!)to define the type of shell that we using.
  • > We can pass arguments to a script, which can be accessed in the script. we use argument using symbol ‘$@’, “$1”.
  • > Migration operation means transfering data from one system to another.
  • > Live Interpreter is like a compiler which gives us output on the fly.
  • > I/O redirection is used to send the input or output to specific file or somewhere we want. The symbol used are “<” and” >”.
  • > Command to cut a field in any file: cut -d”<field_separator>” -f <column_no> <File_name>.

DAY 2

  • > “awk” command is used for pattern matching whether search exist in the file or not.
  • > “watch” command is used in monitoring some program continuously for a certain period of time.
  • > The command for getting the total number of false client hits:

awk ‘ $6==404 { print $1 “ “ $6 }’ file | sort | uniq -c.

  • > Tail command is used to print the last few lines of output of command. By default, its value is 10.
  • > We can use concept of piping i.e (|) pipe symbol for running multiple commands altogether.
  • > To create file without redundancy, we can use command:-

“touch file{1..20}.txt”

  • > The different options available for awk command include: i) -F for delimiter ii) PRINT: to print the output on the command line iii) NR for number of rows iv) NF for number of fields v) END for end of line.
  • > To sort and count the line log file, we can use “sort” command and then count number of lines using “wc-l” command.
  • > To create function in shell script we use following syntax:

function_name() { function_command }

  • > To pass the value to command which requires value on run time we can use “--stdin”.
  • > To search a specific pattern using the awk command we follow the syntax:-

awk ‘/pattern/ { print}’ file

  • > Sed command is used for searching data , inserting data and replacing the data.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Inquisitive Instance of Groups Report

Raki’s DS Adventures: Entry 2 “Jupyter, Spyder & Colab”

Implement replication with `repmgr` and `barman`

Honeypot Farming: Setup Modern Honey Network

How to sort Arrays/Lists in Workato?

Software Architecture — In an agile environment

The Secret to Work-From-Home Joy is in Your Closet, or Maybe Dresser

CDC merge capability comparison of Apache CarbonData and Apache Hudi

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya Pande

Aditya Pande

More from Medium

Bash scripting

SED/AWK Basics

Linux Terminal Commands

Linux Fundamentals