0% found this document useful (0 votes)
21 views24 pages

Understanding OS Shell Functions

The document discusses the characteristics and architecture of UNIX operating systems. It covers topics like multi-tasking, security, file systems, shells, and shell programming. The roles and responsibilities of shells are explained, including executing programs, variable substitution, I/O redirection, and more.

Uploaded by

khawla tadist
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views24 pages

Understanding OS Shell Functions

The document discusses the characteristics and architecture of UNIX operating systems. It covers topics like multi-tasking, security, file systems, shells, and shell programming. The roles and responsibilities of shells are explained, including executing programs, variable substitution, I/O redirection, and more.

Uploaded by

khawla tadist
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Operating Systems - Shell

TADIST Khawla
Ecole d’Ingénierie Digitale et d’Intelligence Artificielle (EIDIA)
Cycle Préparatoire formation Ingénieur

Année 2021-2022

1
UNIX characteristics
 Multi-tasking/Multi-user
 Security (login, password)
 Only users with a login and a passwd can get access
 Connect to system
 Better protection
 File-level permissions
 Portability
 Available for several platforms

2
UNIX characteristics

 File system
 Arborescent
 Distributed
 Flexible reorganization

3
UNIX characteristics

 Integrated communication tools


 Write, email...
 Command system
 Very rich
 Powerful
 Several shells
 Examples: sh, ksh, csh, …
 Interloadable without restarting the machine

4
UNIX characteristics

 User-friendly GUI (Graphical User Interface)


 Windows-like windowing system
 Examples:
 KDE : libraries and APIs providing a cross-platform software abstraction
layer,
 GNOME : a user-friendly free desktop environment whose objective is to
make the use of the operating system accessible…
 Stable
 Rarely crashes
 There is always a way to unblock the process that is blocking the system.
5
UNIX architecture

Communication
tools

Shell

Kernel

rs
Co

Process management

to
mp

Memory

edi
Gestion des processus management
i le

xt
Te
rs

Gestion de la File management


I/O management
mémoire Gestion des
E/S 6
Shell programming

 Computers understand the language of 0’s and 1’s called binary language,
 In early days of computing, instruction are provided using binary language,
which is difficult for reading and writing.
 Shell: a special program.
 Shell accepts your instruction or commands in English and translate it into
computers native binary language.
Convert to
Linux Kernel
Command or Binary
Linux SHELL understands the
shell script language by
request
Shell

7
Shell programming

 Example:

$ ls Request
01001011
$ date BASH processed by
01101010 Linux Kernel
$ time

8
Shell programming

 It is an environment provided for user interaction.


 Shell is a command language interpreter that executes commands from a standard
input device or from a file.

9
Shell programming - Types

Shell Name Developed by Where Remark


BASH (Bourne- Brian Fox and Chet Free Software Most common shell in Linux. It is a
Again SHell) Ramey Foundation freeware shell
CSH (C SHell) Bill Joy University of The C shell’s syntax and usage are very
California (For BSD) similar to the C programming language
KSH (Korn SHell) David Korn AT & T Bell Labs

 Any of the above shell reads command from user and tells Linux OS what users want.
 NOTE: To find your shell type following command
 $ echo $SHELL

10
Shell programming - Responsabilities

11
Shell programming - Responsabilities

 Program Execution
 The shell is responsible for the execution of all programs that are requested
from the terminal.
 Each time a line is sent to the shell, it analyzes the line and then determines
what to do.

12
Shell programming - Responsabilities

 Variable and Filename Substitution


 The shell allows the assignment of values to variables.
 Whenever you specify one of these variables on the command line, preceded
by a dollar sign, the shell substitutes the value assigned to the variable at that
point.

13
Shell programming - Responsabilities

 Variable and Filename Substitution


 The shell also performs filename substitution on the command line.
 In fact, the shell scans the command line looking for filename substitution
characters *, ?, or […] before determining the name of the program to execute
and its arguments.

14
Shell programming - Responsabilities

 I/O Redirection
 It is the shell’s responsibility to manage input and output redirection on the
command line.
 It scans the command line for the occurrence of the special redirection characters
<, >, or >>.

15
Shell programming - Responsabilities

 Pipeline Hookup
 Just as the shell scans the command line looking for redirection characters, it
also looks for the pipe character |.
 For each such character that it finds, it connects the standard output from the
command preceding the | to the standard input of the one following the |.

16
Shell programming - Responsabilities

 Environment Control
 The shell provides certain commands that allow the customizing of the
environment.
 The environment includes the home directory, the characters that the shell
displays to prompt the users to type in a command, and a list of the directories
to be searched whenever a request that a program be executed is sent.

17
Shell programming - Responsabilities

 Interpreted Programming Language


 The shell has its own built-in programming language.
 This language is interpreted, meaning that the shell analyzes each statement in
the language one line at a time and then executes it.

18
Shell programming - Using shell

 How to use Shell


 You start to use your shell as soon as you log into your system
 You have to simply type commands (directly into the terminal) or in a
shell script.

19
Users
 Every person that logs into the machine is considered as a user.
 Every user is assigned a unique user ID number (UID).
 The roots UID is 0.
 User accounts usually start at UID 500.
 1 - 499 UIDs are reserved for the system users.
 Whenever a user is created in Linux it belongs to a specific group.
 User names and UIDs are stored in /etc/passwd.
 Users are assigned a home directory (/home/username) and a program that is run
when they log in (Usually a Shell).
20
Users - permissions

 Typically system users are created when installing the OS and new packages.
 In some cases, a system user can be created and will be used by some applications.
 Normal users are the users created by the root or another user with sudo
privileges.
 Usually, a normal user has a real login shell and a home directory.
 Users have full access to their directories.
 Users cannot read, write or execute each other’s files without a permission.

21
Groups

 A group is a collection of users which make it easier for administration to


perform tasks at the administrative level.
 When permissions and restrictions with the same level to many users need to be
applied, the such permissions and restrictions can be applied to related groups.
 Users are assigned to groups.
 Every user is a member of at least one group and possibly more.
 Each group is assigned a unique group ID number (GID)
 GID’s are stored in /etc/group

22
Groups

 Users have a primary group and can be added to other groups.


 The user’s primary group usually has the same name of the user and it is
defined in the /etc/passwd file.
 When a user creates a file, it is the primary group that is associated with it.
 The user’s secondary group is defined in /etc/group file.
 Secondary groups are those that users might be added to once they already have
accounts.

23
Commands - users and groups
management

 Creating users: $ adduser username


 Changing/setting passwords for users: $ passwd username
 Create a new group: $ groupadd groupname
 Set group password: $ gpasswd groupname
 Change the primary group of the user: $ usermod -g groupname username
 Create a secondary group for a user: $ usermod -G groupname username

24

You might also like