Introduction to Linux Shell and Shell Scripting

Aravind Menon
2 min readApr 27, 2021

Here is my experience of attending a workshop by Vimal Daga Sir on Shell Scripting.

What are Shell Scripts?

A shell script is a file containing a series of commands. The shell reads this file and carries out the commands as though they have been entered directly on the command line.

The shell is somewhat unique, in that it is both a powerful command line interface to the system and a scripting language interpreter. As we will see, most of the things that can be done on the command line can be done in scripts, and most of the things that can be done in scripts can be done on the command line.

Key-Takeaways:

  • Shell Scripting is a method of writing multiple commands together in a file which executes one by one.
  • There are two Operating System Interfaces:
    GUI(Graphical user Interface),
    CLI(Command line Interface).
  • CLI is the command line interface that accepts input from the terminal and executes the OS commands.
  • Shell provides an interface between the user and the kernel for executing commands.
  • Script is the file that contains the list of commands to be executed.
  • Using the $ symbol, we can parametrize the script.
  • Live interpreter runs immediately means as we write the code.
  • I/O redirection is used to redirect the input and output of a command using > or < operators.
  • The awk command is used for pattern scanning. It helps to search for specific patterns.
  • Options available in the awk command:-
    F — for specifying the delimiter
    END — to get the last line
    BEGIN — for printing the starting of the file
    NF — to display the number of fields
    NR — to display the number of records
  • To search a specific pattern using awk command, we can use awk’/pattern/{print}’file.
  • The sed command is known as streaming editor which is used to search, delete, replace and insert.

--

--