Professional Documents
Culture Documents
Unit 2
Unit 2
or block deve,
1. Read: With this permission, a user can read the data or file ser cannot wrt ino
2. Write: With his permission, a user can writ the data o ile
Execute : With hs pemmision, a user can execute the application,
The numberof hard links to the file (Links of the file in the same directory)
The usemame of the owner ofthe fil.
‘ofthe group the file belongs to.
efile in bytes.
it the file was modified last.
The
le cr directory name Pat I
‘The Linux is divided into 3 groups: onner, group and others.
1. Owner: Its the user who creates a particulars ile called as owmer of that fil. The one
person who has all rights on the files created by him and also decides the rights o be
associated to that fie. The owner group i abbreviated as ‘u',
Group: Ina typical software development one large project is divided among die ne |
(of a team, So softwarr developers require that fle ctaining their project should not be wx
‘octher users. Hence, they will apply right to group users. Ii abbrevited as
3. Others: All the uses that are neither owners nor engaged with a ‘group are normally all}
other guest users abbreviated as ‘0!
Changing File Permissions
Decoding File Permissions:
You can decade the cryptic file permissions you've seen when using the Is command He
specify how to decipher the permissions,
Using File Permission Symbols:
‘The ls command displays the ile permissions for files, diesores, and devies on the Litt
“system
Sis
total 68
-ewevt Lich ch $0 2007-09-13 0749 file ge ,
-twxrwar-x | rich rich 4882 2007-09-18 13:58 my
evr 2 rich rich 4096 2007-0.08 15:19 ett
- sfea
9
i
j
j
nerf
her ae
fa
7
1 oats
$a Ea sent iN
et
the field defines the type ofthe object, These are the diferent options f file yPes
on
(0 esd oe trots | for links
3 yracter devi
st
w
| pens
sein
3 Theowner
| a Trego
13 Everyone ele 0
cgonrwar-k 1 rich ric
The
emissions can be changed by tO
|. Binary Masking Mé
2
‘ fidelina Masking Method (Relative
is method, symbols (Abbreviations) @
for oie Pe
for exeoute Pen
sion is denied, a 4
or the object
‘or the object
up that owns the object
wn the system
chmod comman
Jn this method, binat
jethod (Absol
Ted permission for ect
‘ mission for the object
mission forthe object
ich 4882 2007-09-18 13:58 myprog
id is used for changing the permissions of ile
ways:
ute Permission Method! )
ry | or 0 is assigned tothe permissions
| = Assigning (Granting permission)
0 Removing (Revoking permission)
Syntax for Binary Masking:
4 code that describes the permissions forthe files and
ae ces b for block devices n for network devices
are three sets of three characters, Bach set of three characters defines
ash appears inthe location. The three sets relate the three levels of
Binary Number
‘Alename
‘Chmod
Group
Other
Owner
101
01
ul
7
‘Chmod 781 hello.txt
indicate (111) Owner has allt
5 indicate (101) Group user has
| indicate (001) Other or Guest
oR w Write,
Seu a lluses,
Sta, loving permission. (Minus
Erampte:
Che BT hello.tat
dn xyz.txt
5
ree permissions
(Read, Write, and Execute)
Read & Exeoute Permission.
User hi
re used for esignl
x —> Execute, 8 BrOUP
‘ee vAssigning permis
sign)
as Only Execute Permission
‘Method of changin
ig permissions):
ng & removing Permissions:
o— Others
ion (plus sign)_ .
ESS
Drom, when you start a shel session you ate usa
ll want to break out of your home directory and want
71S.3 Working with Directories
AS you can see from the shell
poe
NG
home directory. Most often, you wil
areas inthe Linux sytem, a
‘The linus file organizes into tree structure format connected set of directories cach di “yet
either files or directories,
5 ol
Directory perform 2 main functions:
1. A directory hold files.
2. Directory conneets to other diestoris like a branch in a tree which cen be cone,
= branches also Sette
Files and directories are shown in the tree structure format,
[Root
LT. |
vdev bin home
-- a
‘Kiran (Chirag /Angela
| uN |
Report J Letter|
‘The tre can be shown by oot atthe top. Extending dow ffom the root are the branches ach a
|
‘o"s out of other branch but it can have many lower branches it can said to be parent child strates |
the same way each directory is a subdirectory of one other directory i.e, each directory is a child of pirat
directory. Root is-identified by a forward slash (/), wii
‘re built, coot directory also contain home cirectory which contains the info of all users in the sytem
«ach user home directory ie. Chirag in turn contains the directory which the user has made fo his we.
Jee Dieses:
‘When you log on to system you are placed within home directory. The name given to this dreary
system is the same as your login name, You can crate files in home directory also you can create mit
directories. You can change to these directories and stores file in them, Same is true for users on tess
© each and every users will have his own directory identified by login name and user in turn can cré® FY
tir oWWn directories and subdirectories, i
Consider, a regular user account "Tom", He an store his personal files and directories inthe es 7
"‘home/tom”, He can't save files outside his user directory and does not have access to directories of
users, For instance, he cannot access directory "/home/jerty" of another user account"Jerry". ae A”
When you boot the Linux operating system, your user directory (from the above example ome!
sire
ss the default working directory. Hence the directory "/home/tom is also called the Home
which is @ misnomer
the root directory number of system dietshe directory to identify th
of the it directory isthe pat!
. irctories forms path and these path can be u ie path name The
a from ‘7 ie. r00t directly to home di
‘chically nested
sed 10 identify and reference any directory
tory
root .
| -
Pathname:
\Inomelrober i
| reports | | Letters |
Fo T | .
Pathname: |
Thome/ABCireports Fe |
Pathname: | 7
InomelABCleterfile
‘ile writing the pathname by listing ofeach directory the pathname is separated by °/”. When we are
og ay pth stars with °7 indicate root directory receiving directory name
Eg. omelaboTeters
A/S
oot Decry Home Dreeiay MOMEDHEO User Orecory
Sa
Tofersing Directories:
The change directory command (cd) is what you'll use to move your shell session to another directory
nu filesystem.
The format ofthe ed commend is:
Sdestinaton
vat 4 conmand may tke a single parameter, destination, wbish seis he direstory name you
4010. If you don’t specify a destination onthe comma, it wil take you to your home directory: ~
destination parameter, though, canbe expressed using two different methods:
An absolute filepath
A relative ilepath
_ Mitames are of two types:
‘Absolut path,
Nelatvepath,
sahil ate~ 204" _
ee
Absolute path is complete pathname of a directory or file always begins with
*00tdin
absolute Silepath defines exacly where the directory isin the virtual directory stucnae, Seng
{ of the virtual directory. Sort of like a full nme fora directory, Me a, nis directory & Y
| Exg: uslibvapache 1 na ing it check y
| (1) Ite fst character of patinme is /, the i's loation must be determined wih espe, Ae we cam write S ca
(the first). Such a pathname is called an absolute pathname, Soo sy momelchiis
| = = -12)""When you have more than one /n a pathname, for each such /, you have '0 dcend oe S stem Directories
| the file system, my root directory t
Refative Pathnames: Tre tains Fs
| Nau would have sod that no previous example, we did't use an absolute pate tome | gprs With Pros
eiectory progs | ssn
| Relative pathname begins from your working directory working dtecory isthe. One You ae Contains various |
{t:Relaive feats allow you to specity w destination filpath relative to your eanet Toston wn gong to other di
Tago Sart th rot A eatv lepath det tsar wih frvard la inating "oid Sor ethe terminal
lnstgad, a relative ilepatn stats with either a directory name (i you're wavering tee directory inde)
Fare tt) oscil character indicating a lative locaton to your cuteness leain't| of packup
to special characters used fortis ae: his alvays @ go
| The dot (10 represent the current directory
anally or configure
The double dot (.) to represent the parent directory. ‘eonfgue the the ¢
notte dot charter isextemely handy when tying to averse 4 diet temdy
Goer, aya m the Documents diary under your hme directory and eed goo you bee packap see
Girectory, also under your home directory, you can do this: First backup i
rich@1[Documents]§ od ./Desktop | oo Minimize ti
=~ rich@1 [Desktop] | Tosvoia d
Q Save mone
Q And ultims
‘Abackup im
1 Restoratio
fo Ree
‘What to bacl
Use fie
et),
O Apptica
oe 2 OS fites
QO Applica
s Typesore
Ansoute Patsane rae
/nomelcisteprtsonday Backs
Full back
Tneremen
‘eremen
#
her er absolute path. You can Different
Sometimes the asus pth ald be amples Hee 0 fer abit pa Yous
Jnaracter tilde * * which represents absolute path name of your home directory. Suppose
chara
Differentcu’ dfeCCOFY ANd YOU Want to
pw
~) Wee contents of = ae
“nay yo mete ten By enhance
puis directory & i: © $€€ content, Of file Fp Metter 80 You ¢an Write
Fgeusing it check YOU absolute Path by commani, of Monday din You’, Same way if you
aid ecan write § cat ~/FePorts Mondavi a Dod!
ie
sy homelchris,
hich diag YOU can use tilde sign
POH displays apn isla th
em irectories:
gystem Dit
¢ 1¢ present workir
OME OFF? Where ge 8 eo
ere tilde (~) indicates
t begins with jj
root directory that ith Linux file SY
a contains files and programs head
“sl
7 main Saray Several system directories. The system
sears wal Programs fr executing SPEtii features op Unt’ Many crecores connie other
fust/bin
Beier een
MANS that user ey
aon other directory & the dieson hin hol
7 :
ent system devices such a¢
* the commands,
-fodackup
1 avays & Bo0d practice to keep on backing up data on our computers, this can either be done
nuually oF configured to work automatically, Many back
ncanfigure the the type of backu,
I, time of backup,
sare
Backup is essential
Features that allow ters
ckup activities and many
Q Minimize time from disé
Q Toavoid downtime
Q Save money and time oe
O And ultimatety to save your job
Abackup must Provide
Q Restoration of a single/individual files
O Restoration of file systems
What to backup?
file deleted) or acts of God
User files and dynamic data [databases] (sored in home or spesaly configured Partitions or /var
ete),
Application software (stored in us)
0S fites
‘Shome/user!.dotfiles)
Application configuration files (stored in /ete, /ust/locaV/ete or Shom«
‘YPes of Backyy A 1¢ of them:
ere are different kinds of backups, the following lists som:
Fu Backup :
fil backup means backing up everything. set say
‘Weremental Backup op everting tts hanged ice ls .
s*emental backup means backing U
Diflerentian Backup
incremental.
Differential seems to bbe another name for incrementOperations
—_——. 205
an you! decry ‘and you want to see contents of ‘abe! file by using absolute path, so you can write
[ate ce tile (~) will give you absolute path a /home/chris/ettersthankyou’, Same way if you
na rectory & you want to see contents of fle F2 of Monday directory. So you can use tilde sign
seit chs You absotute path by command ‘pw which display the present working directory
. “an write $ cat ~/eports/Monday/F2, So it displays the ents of F2 Where ti oy)
eaetadiied yfF2, Soit displays the contents of F2 Where tilde (~) indicates
System Directories:
‘The root directory that begins with linux file structure contains several system directories. The system
tory contains fils and programs used to run and maintain the system. Many directories contains ether”
directories with programs for executing specific features of LINUX
eg, /ustbin
Contains various LINUX commands that user executes such as ep - for copy and my ~ for renaming
‘moving to other directory & the directory /bin holds interfaces with different system devices such as
ter or the terminal also consist of the executable file for the commands. “
( Backup
Its always a good practice to Keep on backing up data on our computers, this can either be dane _
ually or configured to work automatically. Many backup tools have different features that allow users
‘configure the the type of backup, time of backup, what to backup, logging backup activities and many
Backup is essential
First a backup is essential. You need 4 good backup strategy to:
OQ. Minimize time from disaster such as server failure or human error (file deleted) or acts of God
Q Toavoid downtime
Save money ané time
OD And ultimately to save your job “— ~
‘A backup must provide
© Restrton of singleindvdual ies
Restoration of file systems
Mat to backup? :
‘User files and dynamic data [databases] (stored in /home or specially configured partitions or /vat
et).
Application software (stored
OS files
Application configuration files (stored in fete, ustflocal/ete or /home/user/.dotfiles)
‘Types of Backup
‘There are different kinds of backups, the following lists some of them:
Full Backup
Full backup means backing up everything,
Incremental Backup
Inctemental backup means backing up everything thet has ‘changed since last full backup.
Differential Backup
Differential seems tobe another name for incremental.
jus)ing up
we server writes them to backs
Jed comm:
|