anjali pandey
3 min readApr 27, 2021

--

Hello, Connections!!!

Recently I attended the workshop on Shell scripting under the mentorship of World Record holder Mr.Vimal Daga that is organized by LinuxWorld Informatics Pvt Ltd

And I’m very happy to share that it is more than a workshop because the content Sir provides us is very valuable and the way Vimal Daga Sir teaches us is totally hands-on and practical.

It is always been a great experience to learn from the best. It’s 8+ hours two days workshop in which we learnt about the concepts :

✓Introduction to Shell Scripting
✓Bash Shell
✓Exit code
✓Shell commands and Setting up PATH
✓if-else conditions
✓for loop and while loop
✓Positional Parameters
✓Use of hashbang/shebang
✓I/O Redirection
✓awk and sed commands
✓Functions
✓Switch-Case

MY Learning from the sessions:

Shell Scripting is a program to write a series of commands for the shell to execute. we can combine a sequence of commands into a single script and automate the script.
Operating system interfaces are
1. Graphical user interface
2. Command Line interface
CLI user interface enables user to give commands to interact with the device.
Shell is an interface between a user and an operating system.
Bourne Again Shell also known as bash.The prompt for this shell is $.It provides a shell to user to interact with operating system.
Variables used in shell script are system defined variable and user defined variable.
exit code tells us weather our program is correct or not,if exit code is 0 then our program is success,if its other than 0 then program has an error.
Script is a set of code to execute the program or to accomplish a task.

output redirection :the output from a command normally intended for stdoutput can be easily diverted to a file.It is notated by “>” input redirection is notated by “<” if you want take input from stdin keyboard or to give input to a file we use this symbol.

While loop is used when loops aren’t predefined

cmd to cut any field from file “cut -f<Field> -d<delimiter> <file> “ ~~ cmd to add timestamp “$(date +%F) “

awk — Linux command to use AWK for some text processing -
- awk ‘{ print }’ file_name — To print complete file
- awk ‘{ print $0 }’ file_name — To print all columns i.e. complete file (If we write not write $0 is same thing, by default it takes $0)
- awk ‘{ print $1 }’ file_name — To print first column only

By default, awk uses Space (“ “) as a delimiter i.e. field separator, So set different delimiter we can use -F option
- aws -F: ‘{ print $1 “ “ $6 }’ /file — To print 1 and 6 column using ‘:’ as field separator

uniq -
- Linux command to print unique lines
- We can use -c option to count the occurance of unique data (uniq -c)

sort -
- Linux command to sort the data
- By default sort treats any data as Strings
- We can use -n option to tell sort that data is a number (sort -n)
- Sort command by default sorts on basis of first column
- We can use -k option to sort on basis of some other column (sort -k3 -> To sort data on basis of 3rd column)
- By default it sorts data in ascending order
- We can use -r option to sort in descending order (sort -r)

--

--