Académique Documents
Professionnel Documents
Culture Documents
September 24,2014
History of Unix
Architecture of Unix
Shell
Unix commands
vi editor
cron tab
Shell scripting
Daemon
2
History of Unix
3
History of Unix
4
Architecture of Unix
The Unix
system
architecture is
3
layered.
5
Shell
Section overview
The shell is a special utility which
-Responsibilities
parses the command line and performs
-types
the following tricks.
Command execution.
Variable substitution.
Filename substitution.
I/O redirection.
Pipeline hookup.
Acts as an interpreted
programming language.
6
Shell
Types of shell
sh
bash
ksh
csh
tcsh
7
Commands
Section overview
Unix commands have the following syntax:
-Regular expressions
-filters
command <-options> <arguments> -decision statements
-loops
Regular expressions
A sequence of characters and wildcards
that form a search pattern.
Regex Matches
. (dot) Any single character
Filters
* Take
(asterisk)
input from input and display the Zero
output or more occurrences
in standard output.
of the preceding character
sed, awk, grep, tr, cut , paste, sort, uniq
[] Any single character
enclosed
8
Commands
Regex Matches
\{n\} Matches n occurrences of
the preceding character.
\(.\) Stores the matched
characters in registers 1-9.
Filters
Commands which take input from standard input
and send the output to standard output.
sed, awk, grep, tr, cut , paste, sort, uniq
9
About friendship
FRIENDSHIP is a relationship of
mutual affection
between 2 or more peoplee.
between 2 or more peoplee.
10
Commands
Decision statements
The exit status of the condition is checked and the
appropriate branch is chosen.
if
case
11
Commands
if construct
if command
then
set of instructions
elif command (optional)
then
set of instructions
else (optional)
set of instructions
fi
12
Commands
case construct
case variable in
value1) set of instructions;;
value2) set of instructions;;
valuen) set of instructions;;
*) set of instructions;; (optional)
esac
13
Commands
Loops
Loops cause a set of instructions to be
executed a predefined number of times.
while
for
until
14
Commands
for construct
for variable in value1 value2 .valuen
for ((variable initialization; condition; updation))
for variable
do
set of instructions
done
15
Commands
while construct
while command
do
set of instructions
done
until construct
until command
do
set of instructions
done
16
vi editor
exiting vi
:w saves the file
:q and :q! exit without saving the file
:wq and :x save and exit from file
17
vi editor
cursor movement
k Moves the cursor up one line
j Moves the cursor down one line
h Moves the cursor left one character
l Moves the cursor right one character
w Move cursor to the start of the next word
b Move cursor to the start of the previous word
0 Moves the cursor to the start of the line
$ Moves cursor to the end the line
:0 Moves the cursor to the first line in file
:$ Moves the cursor to the last line in file
:n Moves the cursor to the nth line in file
18
vi editor
inserting text
i Insert text before cursor
I Insert text at the beginning of the line
a append text after the cursor
A append text at the end of the line
o Insert a new line to add text below the cursor
O insert a new line to add text above the cursor
deleting text
x deletes character under the cursor
X deletes the character before the cursor
dw deletes the word under cursor
dd deletes the line where the cursor rests
19
vi editor
20
cron tab
crontab commands
crontab -l displays the cron tab file
crontab -e opens the cron tab file in editor
crontab -r deletes the cron tab file
21
cron tab
fields values
minute 0 - 59
hour 0 - 23
month 1 - 12
22
daemon
IT Services
Business Solutions
Consulting