The shell is an interface between user and the operating system

  • The operating system shell is the mechanism that carries out the system calls requested by the various parts of the system. 
  • Shell is not part of the operating system kernel. The shell is the part of operating systems such as UNIX and MS-DOS where we can type commands to the operating system and receive a response. 
  • Shell is also called the Command Line Interpreter (CLI) or the “C” prompt. Shell is the primary interface between a user sitting at his terminal and the operating system. Many shells exist, including sh, csh, ksh, and bash.
  • It starts out by typing the prompt, which tells the user that the shell is waiting to accept a command. If the user now types “date” command, the shell creates a child process and runs the date program as the child. 

  • While the child process is running, the shell waits for it to terminate. When the child finishes, the shell types the prompt again and tries to read the next input line. 
  • A more complicated command is: 
                cat file1 file2 file3 | sort > /dev/lp &
  •  This command concatenates three files and pipes them to the sort program. It then redirects the sorted file to a line printer. The ampersand “&” at the end of the command instructs UNIX to issue the command as a background job. This results in the command prompt being returned immediately, whilst another process carries out the requested work. 
  • Above command makes a series of system calls to the operating system in order to satisfy the whole request.