Unix Operating System: 1 STC Technologies
Unix Operating System: 1 STC Technologies
Unix Operating System: 1 STC Technologies
STC Technologies
What is UNIX?
STC Technologies
Components of UNIX
Hardware
STC Technologies
Shell as an Interpreter
The shell is an ordinary program which interprets the commands
that are typed at the terminal, and translates them into commands
that are understood by the kernel.
These programs are located in individual files in one of the system
directories, such as /bin, /etc, or /usr/bin.
The process of command interpretation by the shell can be
explained as follows:
Reads the command
Searches for and locates the file with that name in the directories
containing utilities.
Loads the utility into memory
Executes the utility
Shell scripts of files with program like commands and structures which is
executed in a shell which normally end with .sh extension
man command
whatis command
mkdir
Meaning
cd directory
cd
change to home-directory
cd ~
change to home-directory
cd ..
mv file1 file2
rm file
rmdir directory
remove a file
remove a directory
cat file
display a file
less file
head file
tail file
Meaning
Meaning
cat file1 file2 > file0 concatenate file1 and file2 to file0
sort
sort data
STC Technologies
STC Technologies
To start vi :
Command
vi filename
vi -r filename
To exit vi :
Command
:x<Return>
:wq<Return>
Meaning
edit filename starting at
line 1
recover filename that was
being edited when system
crashed
Meaning
quit vi, writing out modified file to
file named in original invocation
quit vi, writing out modified file to
file named in original invocation
:q<Return>
:q!<Return>
vi
STC Technologies
Cursor Movements
Command
or
<Return>
[or up-arrow]
or <Backspace> [or leftarrow]
k
or
<Space>
0
:0<Return> or 1G
:n<Return> or nG
w
b
:$<Return> or G
10
Meaning
Screen Manipulation
Command
^f
^b
^d
^u
^l
^r
11
Meaning
12
Meaning
STC Technologies
Changing Text
Command
r
R
cw
cNw
C
cc
Ncc
13
or
cNc
Meaning
replace single character under cursor (no <Esc>
needed)
replace characters, starting with current cursor
position, until <Esc> hit
change the current word with new text,
starting with the character under cursor, until
<Esc> hit
change N words beginning with character under
cursor, until <Esc> hit;
e.g., c5w changes 5 words
change (replace) the characters in the current
line, until <Esc> hit
change (replace) the entire current line, stopping
when <Esc> is hit
change (replace) the next N lines, starting with
the current line,
stopping when <Esc> is hit
STC Technologies
Deleting Text
delete single character under cursor
Nx
dw
dNw
D
Ndd
14
dd
or
dNd
STC Technologies
Nyy
or
p
15
yNy
STC Technologies
Searching Text
16
/string
?string
string
in text
string
in text
STC Technologies
:.=
:=
^g
17
STC Technologies
:r filename<Return>
:w<Return>
:w newfile<Return>
:12,35w smallfile<Return>
:w! prevfile<Return>
18
STC Technologies
19
STC Technologies
Meaning
ls -lag
Symbol
20
Meaning
user
group
other
all
read
add permission
STC Technologies
Meaning
command &
^C
^Z
bg
jobs
fg %1
kill %1
ps
kill 26152
21
STC Technologies
Environment Variables
22
STC Technologies
Shell Variables
23
STC Technologies
A Text File
With Instructions
Executable
NB: The two lines of code can be created through vi editor as well