Page 126 - DCAP106_OPERATING_SYSTEM_TOOLS
P. 126

Unit 7: The Shell




          Thus, we can say that the shell  acts as an intermediary among the operating system and the user.   Notes
          The role of shell is to read the command line, interpret its meaning, carry out the command, and
          then return the result through the outputs.
          The  shell  is  considered  as  an  executable  file  which  is  liable  for  interpreting  the  commands,
          transmitting them to the system, and returning the result. There are several shells. The most
          common shell is  sh (“Bourne shell”), bash (“Bourne again shell”), csh (“C Shell”), Tcsh (“Tenex
          C shell”), ksh (“Korn shell”), and zsh (“Zero shell”). We have discussed these shells in this unit.


             Did u know? Generally, the name of the different shells matches the name of the executable.

          Every user has a default shell. This default shell will be launched on opening of a command
          prompt. We specify default shell in the dans configuration file /etc/passwd in the last field of
          the line corresponding to the user. It is possible to change the shell during a session by simply
          executing the corresponding executable file.


                 Example:
          /bin/bash
          We initialize shell by reading its overall configuration (in a file of the directory /etc/), followed
          by reading the user’s own configuration (in a hidden file whose name begins with a dot, situated
          in  the  basic  user  directory,  that  is,  home/user_name/.configuration_file).  Then,  a  prompt  is
          displayed as follows:
          machine:/directory/current$
          By default, the prompt (for most shells) include the machine name, followed by two points (:), the
          current directory, and then a character signifying the type of user connected:
          z z  “$” specifies a normal user

          z z  “#” specifies the administrator, called “root”
          We can define a command line as a chain of characters which represents a command corresponding
          to an executable file of the system or rather a shell command and optional arguments (parameters):

          ls -al /home/jf/
          In the above command, ls signifies the name of the command, -al et /home/jean-francois/ are
          arguments. Arguments starting with - are known as options. Generally, for each command, there
          is a certain number of options which can be detailed by typing one of the following commands:

          command --help
          command -?
          man command
          The shell gives an interface to Linux. In this interface, commands can be typed or entered by
          using the keyboard. It is called the command line interface (CLI). To find out your current shell
          type following command:
          echo $SHELL

          ps $$
          ps -p $$







                                           LOVELY PROFESSIONAL UNIVERSITY                                   119
   121   122   123   124   125   126   127   128   129   130   131