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

PPTX
Introduction to php
PDF
Php array
PDF
Django Introduction & Tutorial
PPTX
System program
PPTX
html-table
PPTX
HTML Text formatting tags
PPT
Php forms
PDF
4.2 PHP Function
Introduction to php
Php array
Django Introduction & Tutorial
System program
html-table
HTML Text formatting tags
Php forms
4.2 PHP Function

What's hot (20)

PPTX
Introduction to php
PDF
CSS notes
PPT
cascading style sheet ppt
PPT
Shell Scripting
PPTX
Javascript event handler
PPT
Scripting languages
PPTX
Php string function
PPTX
Basic html structure
PPT
Basic 50 linus command
PPTX
Php basics
PPTX
Client side &amp; Server side Scripting
PPTX
css.ppt
PPTX
Introduction to HTML
PPTX
Vi editor
PPTX
HTML/HTML5
PPT
PHP - Introduction to PHP Forms
PPTX
Cascading style sheets (CSS-Web Technology)
PPTX
PDF
P code
PPTX
Css types internal, external and inline (1)
Introduction to php
CSS notes
cascading style sheet ppt
Shell Scripting
Javascript event handler
Scripting languages
Php string function
Basic html structure
Basic 50 linus command
Php basics
Client side &amp; Server side Scripting
css.ppt
Introduction to HTML
Vi editor
HTML/HTML5
PHP - Introduction to PHP Forms
Cascading style sheets (CSS-Web Technology)
P code
Css types internal, external and inline (1)
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
linux chapter 5.pptx lesson About introduction to linux
PPSX
Unix environment [autosaved]
PPTX
PPT
Linux Administration
PPT
Linux Administration
PDF
Lecture1 2 intro-unix
PPTX
Unix Shell Script - 2 Days Session.pptx
PDF
Linux intro 2 basic terminal
PPT
linux-lecture4.ppt
PPTX
Basics of Unix Adminisration
DOC
58518522 study-aix
PPT
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
PPTX
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
PPT
Linux commands and file structure
PPTX
Chapter 2 Linux File System and net.pptx
PDF
Linux_Commands.pdf
PPTX
linux system administration for system admin jobs
PPTX
Unix Trainning Doc.pptx
PowerPoint_merge.ppt on unix programming
various shell commands in unix operating system.pptx
linux chapter 5.pptx lesson About introduction to linux
Unix environment [autosaved]
Linux Administration
Linux Administration
Lecture1 2 intro-unix
Unix Shell Script - 2 Days Session.pptx
Linux intro 2 basic terminal
linux-lecture4.ppt
Basics of Unix Adminisration
58518522 study-aix
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
Linux commands and file structure
Chapter 2 Linux File System and net.pptx
Linux_Commands.pdf
linux system administration for system admin jobs
Unix Trainning Doc.pptx
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
PROGRAMMING-QUARTER-2-PYTHON.pptxnsnsndn
PPTX
02fdgfhfhfhghghhhhhhhhhhhhhhhhhhhhh.pptx
PPTX
title _yeOPC_Poisoning_Presentation.pptx
PPTX
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
PPT
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
PPTX
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
PPTX
material for studying about lift elevators escalation
PPTX
Wireless and Mobile Backhaul Market.pptx
PDF
How NGOs Save Costs with Affordable IT Rentals
PPTX
Sem-8 project ppt fortvfvmat uyyjhuj.pptx
PPT
Lines and angles cbse class 9 math chemistry
PPTX
Lecture-3-Computer-programming for BS InfoTech
PPTX
Nanokeyer nano keyekr kano ketkker nano keyer
PPTX
PLC ANALOGUE DONE BY KISMEC KULIM TD 5 .0
PPTX
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
PPTX
Presentacion compuuuuuuuuuuuuuuuuuuuuuuu
PPTX
sdn_based_controller_for_mobile_network_traffic_management1.pptx
PPTX
Syllabus Computer Six class curriculum s
DOCX
fsdffdghjjgfxfdghjvhjvgfdfcbchghgghgcbjghf
PPTX
INFERTILITY (FEMALE FACTORS).pptxgvcghhfcg
PROGRAMMING-QUARTER-2-PYTHON.pptxnsnsndn
02fdgfhfhfhghghhhhhhhhhhhhhhhhhhhhh.pptx
title _yeOPC_Poisoning_Presentation.pptx
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
material for studying about lift elevators escalation
Wireless and Mobile Backhaul Market.pptx
How NGOs Save Costs with Affordable IT Rentals
Sem-8 project ppt fortvfvmat uyyjhuj.pptx
Lines and angles cbse class 9 math chemistry
Lecture-3-Computer-programming for BS InfoTech
Nanokeyer nano keyekr kano ketkker nano keyer
PLC ANALOGUE DONE BY KISMEC KULIM TD 5 .0
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
Presentacion compuuuuuuuuuuuuuuuuuuuuuuu
sdn_based_controller_for_mobile_network_traffic_management1.pptx
Syllabus Computer Six class curriculum s
fsdffdghjjgfxfdghjvhjvgfdfcbchghgghgcbjghf
INFERTILITY (FEMALE FACTORS).pptxgvcghhfcg

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.