Basic Unix
Basic Unix
User
Application Programs
Shell
Kernel
Hardware
Overview in file system
Topics:-
/sbin
/usr
/var
/etc
/dev
/opt
/tmp
/lib
/home
Example Directory Structure
root (/)
jack jill
Bats marsupials
continents oceans
bin: Software for the shell and most common Unix commands. Ex:-cat,who
dev: Short for devices, holds the software necessary to operate peripherals such
as printers and terminals. Ex:-lp,hd
etc: Contains various administrative files such as lists of user names and
passwords.
Ex:-/etc/passwd,/etc/shadow
var: Files that contain information that varies frequently; most commonly, mail
directories.
Ex:-/var/adm/spool
/usr:-this is where the manual pages are stored. There are
separate sub-directories here (like man1,man2,etc)
that contain the pages
For ex the man page of ls can be found in
/usr/share/man/man1
/lib:- contains all library files in library form. You need to link
your c programs with files in these directories
Working with files and
directories
File and Directory Names
•Absolute Path
•Relative path
Absolute Pathnames
Deleting directories
$rmdir <dir name> => If the dir is empty this command is
applicable
$rm <options> <dir name> =>If the dir is not empty this
command is applicable.
-i => Interactively
-r => Recursively
-f => forcefully
Creating files:-
Note:If you create a file with touch an empty file will be created.
Removing files:-
$rm <F.N>
Ex:- $cp f1 d1
From the above example the file f1 is transferred i.e
copied to dir d1
I/O Redirection
-rw------- a file that only the owner can read and write - no-
one else can read or write and no-one has
execution rights (e.g. your mailbox file).
Unix File Permissions
Topics:-
Definition of process
Types of process
as Foreground process
Background process:-
Some processes take a long time to run and hold up the terminal.
Backgrounding a long process has the effect that the UNIX prompt is
returned immediately, and other tasks can be carried out while the
Just specify & before after the command it goes to back ground
$kill -9 <PID>
Vi Editor
Brief History
What is Vi ??
Command to start Vi : vi
Modes of Operation
Command Mode
Allows the entry of commands to manipulate text
Commands are usually one or two characters long
Insert Mode
Puts anything you type on the keyboard into the current file
Vi Editor
Once in insert mode, you get out of it by hitting the Esc key
Vi Editor
R
Starting from the current cursor position, replace the characters
with the one typed on the keyboard
u
undo the last change to the file
Vi Editor
l
Move the cursor to the right one character position
j
Move the cursor down one line
k
Move the cursor up one line
Vi Editor
Cutting text
d^
Deletes from current cursor position to the
beginning of the line
d$
Deletes from current cursor position to the
end of the line
dw
Deletes from current cursor position to the
end of the word
dd
Deletes one line from current cursor position. Specify
count to delete many lines.
Vi Editor
String Search
/[pattern] : search forward for the pattern
?[pattern] : search backward for the pattern
FILTERS
fg Foreground execution
Activities of shell
The shell issues the prompt and waits for you to enter a
command.
It the passes on the command line to the kernel for execution.
The shell waits for the command to complete and normally can’t
do any work while the command is running.