Page 251 - DCAP403_Operating System
P. 251

Operating System




                    Notes          Shell Penal

                                   The command interpreter is the interface between the user and the operating system, hence its
                                   name “shell”.
                                                                 Users
                                                                        Shell

                                                                       Kernel





                                   The shell therefore acts as an intermediary between the operating system and the user using
                                   command lines entered by the latter. Its role consists of reading the command line, interpreting
                                   its meaning, executing the command, and then returning the result via the outputs.

                                   The shell is an executable file responsible for interpreting commands, transmitting them to the
                                   system, and returning the result. There are several shells, the most common being sh (called the
                                   “Bourne shell”), bash (“Bourne again shell”), csh (“C Shell”), Tcsh (“Tenex C shell”), ksh (“Korn
                                   shell”),and zsh (“Zero shell”). Their name generally matches the name of the executable.
                                   Each user has a default shell, which will be launched when a command prompt is opened.

                                   The default shell is specified in the confi guration file /etc/passwd in the last field of the line


                                   corresponding to the user. It is possible to change the shell during a session simply by executing
                                   the corresponding executable file, for example:

                                   /bin/bash
                                   Command Prompt Window (Prompt)



                                   The shell is initialized by reading its overall configuration (in a  file of the directory /etc/),

                                   followed by reading the user’s own configuration (in a hidden file the name of which starts with

                                   a dot, located in the basic user directory, i.e. /home/user_name/.confi guration_file). Then, a

                                   command prompt window or prompt is displayed as follows:
                                   machine:/directory/current$
                                   By default, for most shells, the prompt consists of the name of the machine, followed by a colon
                                   (:), the current directory, then a character indicating the type of user connected:

                                   1.  “$” specifies a normal user

                                   2.  “#” specifies the administrator, called “root”
                                   Command Line Concept

                                   A command line is a character string representing a command corresponding to an executable
                                   system file or shell command along with optional arguments (parameters):

                                   ls -al /home/jf/
                                   In the above command, ls is the name of the command, -al and /home/jean-francois/ are
                                   arguments. Arguments beginning with - are called options. Generally, for each command
                                   there are a certain number of options which can be detailed by entering one of the following
                                   commands:
                                   command --help
                                   command -?
                                   man command



          244                              LOVELY PROFESSIONAL UNIVERSITY
   246   247   248   249   250   251   252   253   254   255   256