SlideShare a Scribd company logo
UNIX System Architecture
Hardware
Kernel
Shell
Tools and Applications
2. UNIX OS System Architecture easy.pptx
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:
1. File management
2. Process management
3. Memory management
4. Converting data from user level to machine
level.
5. CPU scheduling
6. 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
1. Bourne shell
2. C shell
3. Korn shell
4. Bourne – again 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.

More Related Content

PPT
Version Control System
PPTX
Feature driven development (FDD)
PPT
SonarQube Overview
PPTX
[GPG스터디] 1.0 데이터 주도적 설계의 마법
PPTX
XamarinExpertDay - Creating PDF files in mobile apps with PdfSharpCore and Mi...
PPT
Fdd presentation
PPTX
git, 이해부터 활용까지
PPT
Pressman ch-21-project-management-concepts
Version Control System
Feature driven development (FDD)
SonarQube Overview
[GPG스터디] 1.0 데이터 주도적 설계의 마법
XamarinExpertDay - Creating PDF files in mobile apps with PdfSharpCore and Mi...
Fdd presentation
git, 이해부터 활용까지
Pressman ch-21-project-management-concepts

What's hot (20)

PDF
svn 능력자를 위한 git 개념 가이드
PDF
FDD Overview
ODP
PDF
Git - An Introduction
PDF
git and github
PPTX
User and groups administrator
PPT
Linux Administration
PPTX
Basic commands of linux
PDF
BDD in Action – principles, practices and real-world application
DOCX
open project tool
PDF
Crontab
PPTX
Chapter 2 Time boxing &amp; agile models
PPTX
Software review
PPTX
Software project estimation
PPTX
PROTOTYPE MODEL
PPT
Istqb chapter 5
PDF
Git - Level 2
PDF
발표자료 1인qa로살아남는6가지방법
PPTX
Agile Software Development Life Cycle
PPTX
Maintenance, Re-engineering &Reverse Engineering in Software Engineering
svn 능력자를 위한 git 개념 가이드
FDD Overview
Git - An Introduction
git and github
User and groups administrator
Linux Administration
Basic commands of linux
BDD in Action – principles, practices and real-world application
open project tool
Crontab
Chapter 2 Time boxing &amp; agile models
Software review
Software project estimation
PROTOTYPE MODEL
Istqb chapter 5
Git - Level 2
발표자료 1인qa로살아남는6가지방법
Agile Software Development Life Cycle
Maintenance, Re-engineering &Reverse Engineering in Software Engineering
Ad

Similar to 2. UNIX OS System Architecture easy.pptx (20)

PPT
PowerPoint_merge.ppt on unix programming
PPTX
various shell commands in unix operating system.pptx
PPTX
Unix Shell Script - 2 Days Session.pptx
PDF
LinuxCommands (1).pdf
PPT
Linuxnishustud
PPTX
linux chapter 5.pptx lesson About introduction to linux
PPTX
Basic Linux Administration - 3.pptxon server
PPTX
Linux Commands all presentation file .pptx
PPTX
Linux Fundamentals
PPTX
Linux commands
PPTX
PPT
redhat_by_Cbitss.ppt
PPTX
LINUX_admin_commands.pptx
PPTX
os lab commanaaaaaaaaaaaaaaaaaaaaaads.pptx
PPTX
PPT
Linux: Basics OF Linux
PPTX
Linuxtraining 130710022121-phpapp01
PPTX
Linux System commands Essentialsand Basics.pptx
PPT
Unix cmc
PPTX
Linux basics
PowerPoint_merge.ppt on unix programming
various shell commands in unix operating system.pptx
Unix Shell Script - 2 Days Session.pptx
LinuxCommands (1).pdf
Linuxnishustud
linux chapter 5.pptx lesson About introduction to linux
Basic Linux Administration - 3.pptxon server
Linux Commands all presentation file .pptx
Linux Fundamentals
Linux commands
redhat_by_Cbitss.ppt
LINUX_admin_commands.pptx
os lab commanaaaaaaaaaaaaaaaaaaaaaads.pptx
Linux: Basics OF Linux
Linuxtraining 130710022121-phpapp01
Linux System commands Essentialsand Basics.pptx
Unix cmc
Linux basics
Ad

More from Priyadarshini648418 (12)

PPTX
Process scheduling commands in unix.pptx
PPTX
DBMS_Online database management sys.pptx
PPTX
3. Context of a process in a unix .pptx
PPTX
1 Data Manipulation, data mining techniq
PPT
Applied artificial intelligece of pg.ppt
PPT
AAI expert system and their usecases.ppt
PPTX
deep learn about blood vessel auto1.pptx
PPT
Applied Artificial Intelligence presenttt
PPTX
Nest_Dictionaries in python coding1.pptx
PPTX
Gender Recognition in the voice PPT.pptx
PPTX
Data Science Machine Lerning Bigdat.pptx
PPTX
Unix_Introduction_BCA.pptx the very basi
Process scheduling commands in unix.pptx
DBMS_Online database management sys.pptx
3. Context of a process in a unix .pptx
1 Data Manipulation, data mining techniq
Applied artificial intelligece of pg.ppt
AAI expert system and their usecases.ppt
deep learn about blood vessel auto1.pptx
Applied Artificial Intelligence presenttt
Nest_Dictionaries in python coding1.pptx
Gender Recognition in the voice PPT.pptx
Data Science Machine Lerning Bigdat.pptx
Unix_Introduction_BCA.pptx the very basi

Recently uploaded (20)

PPTX
Embedded for Artificial Intelligence 1.pptx
PPTX
Embeded System for Artificial intelligence 2.pptx
PPTX
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
PPTX
Operating System Processes_Scheduler OSS
PPTX
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
PPTX
unit1d-communitypharmacy-240815170017-d032dce8.pptx
PPT
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
PPTX
Prograce_Present.....ggation_Simple.pptx
PPTX
Wireless and Mobile Backhaul Market.pptx
PPTX
Fundamentals of Computer.pptx Computer BSC
PPTX
02fdgfhfhfhghghhhhhhhhhhhhhhhhhhhhh.pptx
PDF
ICT grade for 8. MATATAG curriculum .P2.pdf
PPTX
Lecture-3-Computer-programming for BS InfoTech
PPTX
Embedded for Artificial Intelligence 2.pptx
PPTX
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
DOCX
fsdffdghjjgfxfdghjvhjvgfdfcbchghgghgcbjghf
PPTX
A Clear View_ Interpreting Scope Numbers and Features
PDF
Tcl Scripting for EDA.pdf
PDF
Presented by ATHUL KRISHNA.S_20250813_191657_0000.pdf
PPTX
quadraticequations-111211090004-phpapp02.pptx
Embedded for Artificial Intelligence 1.pptx
Embeded System for Artificial intelligence 2.pptx
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
Operating System Processes_Scheduler OSS
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
unit1d-communitypharmacy-240815170017-d032dce8.pptx
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
Prograce_Present.....ggation_Simple.pptx
Wireless and Mobile Backhaul Market.pptx
Fundamentals of Computer.pptx Computer BSC
02fdgfhfhfhghghhhhhhhhhhhhhhhhhhhhh.pptx
ICT grade for 8. MATATAG curriculum .P2.pdf
Lecture-3-Computer-programming for BS InfoTech
Embedded for Artificial Intelligence 2.pptx
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
fsdffdghjjgfxfdghjvhjvgfdfcbchghgghgcbjghf
A Clear View_ Interpreting Scope Numbers and Features
Tcl Scripting for EDA.pdf
Presented by ATHUL KRISHNA.S_20250813_191657_0000.pdf
quadraticequations-111211090004-phpapp02.pptx

2. UNIX OS System Architecture easy.pptx

  • 3. 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: 1. File management 2. Process management 3. Memory management 4. Converting data from user level to machine level. 5. CPU scheduling 6. Dealing with interrupts from hardware devices.
  • 4. 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.
  • 5. Types of shells 1. Bourne shell 2. C shell 3. Korn shell 4. Bourne – again 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
  • 6. 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
  • 7. 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
  • 8. 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.
  • 9. 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.
  • 10. 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.
  • 11. • 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.)
  • 12. • 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.
  • 13. 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.
  • 14. Directory commands • pwd • cd • mkdir • rmdir • mv • tree
  • 15. 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
  • 16. 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
  • 17. • 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.
  • 18. 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
  • 19. File related commands • cat • cp • mv • rm • touch • ls • more • head • tail
  • 20. 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>
  • 21. 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
  • 22. 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.
  • 23. 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
  • 24. 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
  • 25. 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.
  • 26. 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
  • 27. 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*)
  • 28. 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
  • 29. 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.
  • 30. 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
  • 31. 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
  • 32. 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
  • 33. 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
  • 34. 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
  • 35. 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
  • 36. 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
  • 37. comm • Compares two sorted files and shows lines that are same and those that are different. Ex: $comm bcalist bsclist
  • 38. 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.
  • 39. 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
  • 40. 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.
  • 41. • 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.