2. UNIX OS System Architecture easy.pptx

188 views 41 slides Mar 02, 2024
Slide 1
Slide 1 of 41
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41

About This Presentation

it is a simple and easy presentation on the unix system architecture. v=can be used by the school and colllege students


Slide Content

UNIX System Architecture Hardware Kernel Shell Tools and Applications

Kernel Core of the operating system Collection of programs and sub routines written in C Is in direct control of the underlying hardware Functions include: File management Process management Memory management Converting data from user level to machine level. CPU scheduling Dealing with interrupts from hardware devices.

Shells and GUIs Shell acts as a command interpreter, which interprets the user commands and transfers them to the kernel for execution Performs as an interface between the user and the kernel. Only one kernel and there can be several shells running in the memory, one for every logged – in user. Shell invokes a command line prompt (for ex: $), where the user can type a UNIX command.

Types of shells Bourne shell C shell Korn shell Bourne – a gain shell Bourne shell Most common shell distributed with UNIX system. Is named after its author Stephen Bourne Most widely used shell Executable filename is sh

C shell Developed by Bill Joy Coding is similar to C programming language Shell scripts of this will not work with Bourne shell Major advantage over Bourne shell is its ability to execute processes in the background. Executable file is csh TC shell( tcsh ) is a free version of C shell under Linux

Korn shell Developed by David Korn Combines the best features of Bourne shell and C shell One of the widely used shells Runs Bourne shell scripts without any changes Executable file is ksh Bourne – Again shell Developed by Fox and C Ramey Default shell for most Linux operating systems and its variants Executable file is sh

File system A major component. Is organized in an hierarchical manner. In UNIX, everything including hardware devices is treated as a file. Resembles a tree structure with its root at the top. Can be local or distributed.

System utilities and application programs System utilities such as ls , cp, grep , bc etc. perform a single task extremely well. System utilities provide remote network and administration services Application programs in Linux include editor, c compiler, drawing package, Soffice ( StarOffice ) etc.

UNIX command format UNIX commands can be very simple one word commands or they can take a number of additional arguments (parameters) as part of the command. In general a UNIX command has the following general form... $command option(s) filename(s) The command is the name of the utility or program that we are going to execute. Ex: $ rm –i test1 #the command rm deletes the file test1, -i prompts before deleting file.

The options are passed into the command to modify the way the command works. It is typical for these options to have be a hyphen followed by a single character, such as -l . The filename is the last argument for a lot of UNIX commands. It is simply the file or files that we want the command to work on. Take note that not all commands work on files, such as ssh which takes the name of a host as its argument. (The ssh command is  used  to logging into a remote host and execute  commands  on the remote machine.)

The  clear  command, which is used to remove all previous commands and output from the display screen, is one of the rare commands that accepts neither options nor arguments. 

UNIX internal and external commands UNIX commands are classified into two types Internal Commands - Ex: cd , echo,fg External Commands - Ex: ls , cat Internal Command: Internal commands are something which is built into the shell. For the shell built in commands, the execution speed is really high. It is because no process needs to be generated for executing it.   For example, when using the " cd " command, no process is created. The current directory simply gets changed on executing it. External Command: External commands are not built into the shell. These are executables present in a separate file. When an external command has to be executed, a new process has to be generated and the command gets executed. For example, when you execute the "cat" command, which usually is at / usr /bin, the executable / usr /bin/cat gets executed.

Directory commands pwd cd mkdir rmdir mv tree

pwd - print working directory or present working directory) Prints the absolute pathname of our current working directory The pwd command can have options, but it doesn’t take any arguments Syntax & Ex: $ pwd cd - changing the directory Is used to move from one directory to another. Uses a pathname (either relative or absolute) as its argument. Syntax: $ cd directoryname Ex: $ cd /home/ harley /essays To change to the / (root directory), use: $ cd / To return to home, use: $ cd To change to the parent directory, use: $ cd .. Please note: There is a space between the command cd and its argument

mkdir – making directory To make a directory, we use mkdir command. Syntax: $ mkdir directoryname Examples: $ mkdir extra $ mkdir sample1 sample2 rmdir – removing directory Removes one or more directories or sub – directories Directories can be removed only when they are empty. Ex: $ rmdir sample1

A directory tree can be removed recursively and forcefully using the rm command with the –r and –f options mv – moving or renaming a directory To move or rename a directory, we use mv command Syntax: $ mv directory target where directory is the directory we want to move or rename and target is the target or new name Ex: $ mv data extra We use mv command to “move” a directory from one place to another. The command mv both moves and renames.

tree Lists the contents of directories in a tree like format. Options –d (list directories only), -f (prints the full path prefix for each file), -p (list a tree that also shows the file permissions) Ex: $tree -p

File related commands cat cp mv rm touch ls more head tail

cat Is used for creating files, displaying contents of the files, concatenating files and for appending files. Creating files: Can be used to create small files. Takes input from keyboard and sends the output to the monitor. Ex: $cat > fruits Apple Orange Grapes <ctrl d>

Displaying contents of files cat can be used to display the contents of the one file or more than one files Examples: $cat fruits $cat fruits vegs Concatenation of files cat command can concatenate the contents of two or more files and store them in another file. Ex: $cat test1 test2 > test3

Append files The cat command can be used to append or add data to the contents of the file using the symbol >> Ex: $cat >> fruits Pineapple Guava <ctrl d> Can also be used to append the contents of one file to another file Ex: $cat fruits >> item Options with cat command are –v (displays non – printable ASCII characters also), -n (numbers the lines in the file) etc.

cp Can copy a file or a group of files, across directories. Syntax: $cp < source_file > < new_filename > Ex: $cp test1 test2 #creates an exact copy of test1 with file name as test2 More than one file can be copied into another directory Ex: $cp test1 test2 testdir

cp options -i : interactive, prompts the confirmation before overwriting the target file. -r : is recursive copying -p : copies the file and preserves the attributes such as owner id, group id, permissions and last modification time

mv – moving or renaming a file To move or rename a file, we use mv command Syntax: $ mv filename target Where filename indicates the file we want to move or rename and target is the target or new name Ex: $ mv veg vegetables We use mv command to “move” a file from one place to another. The command mv both moves and renames. A group of files can also be moved into a directory.

mv options: -f : suppresses all prompting and forces overwriting of target file. -i : prompts before overwriting of destination file -p : preserves the attributes such as owner id, group id, permissions and last modification time

rm Is used to delete one or more files Meta characters(*,? etc.) can be used to delete files with common patterns Syntax: $ rm filename Ex: $ rm fruits rm options: - f : suppresses all prompting. -i : prompts before deleting files -r : is recursively removes the files. (Ex: $ rm –r*)

touch Is used to create empty files Examples: $touch course1 $touch course1 course2 touch options -a : to change the access time -m : to change the modification time

ls Is used to display all the files and sub directories in a current directory ls options: -a : list all files including hidden files. -x : list the content in a row – wise format. -r : list the contents, sorted in a reverse alphabetical order. -i : displays inode numbers of files -l : display all the files and subdirectories in the long format including permissions, file type, owner id, group id etc. -u : list the contents based on the access time or usage time.

Meta characters can be used with ls command as follows: $ ls *t : list all files ending with the letter t. $ ls p* : list all files starting with the letter p. $ ls ?at : list all three letter file names ending with ‘at’ and starting with any character. $ ls [ abc ]* : list all files starting with the letters a, b or c. $ ls [! abc ]* : list all file names which do not start with the alphabets a, b or c $ ls / : lists the contents of the root directory

more Is used to view the contents of a file page by page. Takes one or more file names as arguments Ex: $more studdet.txt The user can quit from more by typing q

head Is used to display the first few lines of one or more files Without any options, by default, it displays first 10 lines of the file. Examples: $head bcalist $head -4 bcalist The head command can be used with multiple files Ex: $head -2 bcalist bsclist

tail Is used to display the last few lines of a file. By default, it displays the last 10 lines of the file. Examples: $tail bcalist #displays the last 10 lines $tail -4 bcalist #displays the last 4 lines $tail +7 bcalist #displays all the lines starting from the line number 7 up to end of file The tail command cannot take multiple files

Comparing files The commands for comparing files can be used to compare two versions of the same file. Most common commands for comparing two files are: cmp diff comm

cmp Is used to determine whether the two files are identical in all respects. When files are identical, system prompt appears without any message. When there are differences, the location of the first mismatch is echoed on the screen. Ex: $ cmp bcalist bsclist

diff It first compares the two files byte by byte, and indicates the differences. Also tells how the contents of the first file can be changed to match the text from the second file and vice versa. Ex: $diff bcalist bsclist

comm Compares two sorted files and shows lines that are same and those that are different. Ex: $ comm bcalist bsclist

Disk related commands The df command - disk free Reports the amount of free space available for each file system separately. Examples: $ df $ df -h df options: -h : print sizes in human readable format (e.g., 1K 234M 2G) -T : print file system type. -a : include dummy file systems - i : list inode information instead of block usage.

The du command – disk usage It estimates and displays the disk space used by files. Ex: $ du du options: -a : displays the space that each file is taking up - ch : displays file sizes and the total capacity of all files combined -k : reports the file sizes in units of 1024 bytes

The ulimit command – user limit This command is used to control occupying huge amount of space by files created by users. When applied at the command prompt ulimit displays a value which signifies the largest file that can be created by the user in the file system. Ex: $ ulimit The default value of Solaris and Linux for ulimit is unlimited.

An ordinary user can decrease the value, but cannot increase it. Once the limit is decreased, it remains effective till the user logs out. A super user can use ulimit to impose restriction on the maximum file size, that a user is allowed to create. A super user can increase or decrease the value of ulimit .
Tags