You are on page 1of 8

CHAPTER 2

Hard disks:
PATA - Parallel Advanced Technology Attachment
SATA - Serial Advanced Technology Attachment
SCSI - Small Computer Systems nter!ace
"nlike PATA# can have more than one SATA$SCS %ithin a system
&amed sda# sd' (((
n )indo%s C is a !ilesystem %ithin a partition
Hard disks can contain a ma* o! + main partitions ,primary partitions-
Can have unlimited partitions ,called logical drives- %ithin primary partitions renamed extended
partitions
Master Boot record - MBR - ta'le that contains all the partition in!ormation
.imited to hard disks that are less than 2T/ in si0e
.arger than 2T/ uses GUID partition ta'le
Primary master PATA hard disk - da
1
st
primary partition on drive - da!" 2
nd
is da#
2or SATA and SCS# replace hda %ith sda
Common types o! !ile systems - ext#" ext$" ext%" &'AT and R(IS(R
) - all directories not on other !ile systems 134/ or more
)*oot - contains linu* kernel and 'oot !ile 2335/
)ome - user home directory - 2335/$user
)+sr - system commands and utilities - 234/ or more
)+sr)local - location !or most additional programs - 234/ or more
)opt - alternative location !or additional programs - 234/ or more
)var - contains log !iles and spools - i! it is a print server - 134/ or more# other%ise 24/ or more
)tmp - holds temporary !iles created 'y programs - 6335/
(xt# is the traditional !ile system used on most linu* systems
&'AT ,&irt+al 'ile Allocation Ta*le- !ile system is compati'le %ith 2AT and 2AT72
(xt$" ext% and R(IS(R are more ro'ust than ext#" since they per!orm .o+rnaling/
0o+rnaling !ilesystem keeps track o! the in!ormation %ritten to the hard disk in a 8ournal(
)ith a 8ournaling !ile system# each step re9uired to copy the !ile to the ne% location is !irst %ritten to a
8ournal - this means the system can retrace the steps the system took prior to a po%er outage and
complete the !ile copy( They also o!!er !aster data trans!er and inde*ing(
1ogical &ol+me Manager - used to create logical volumes
RAID - redundant array o! ine*pensive disks - so!t%are 'ased volume that spans multiple disks
/oot loader - program started 'y /:S at system startup# that loads .inu* kernel into memory
2rom a hard disk partition inside the computer( t can 'e used to 'oot other :S such as %indo%s i! it
e*ists on the hard drive( ;uring 2edora 17 installation# the 'oot loader con!igured is 4R"/ - 4R and
uni!ied 'ootloader
.inu* users are authenticated 'y a pass%ord data'ase on the local computer
2et3or4 In5ormation Service ,2IS- shares pass%ord data'ases among .inu* systems
1igt3eigt Directory Access Protocol ,1DAP-" 'ree Identity Policy" A+dit ,'reeIPA- and
6in*ind are types o! authentication and user in!ormation services(
;ate and time can 'e o'tained !rom a relia'le time server on the internet using 2et3or4 Time
Protocol ,2TP-/
/asic .inu* "sage
<ernel - core component that loads all the other components and centrally controls computer(
n .inu* this is a !ile usually called =vmlin+7>
Shell is the user inter!ace a user sees %hen logging in via a terminal/
Bas shell - /ourne Again shell - is de!ault shell
Commands are not entered directly to the kernel(
;e!ault 4" environment in 2edora is G28M(
Ls -a /etc/ntp -- .ists all !iles in the directory
$ metacharacter re!ers to a varia'le
Echo My shell is $SHELL
To protect a metacharacter ,such as ? !rom shell intepretation- # percede
t %ith a @
Shift + page up to move up a page o! output
Ctrl A C - to cancel command
Echo Today is date
Man - manual pages
Man whoami
Man - us! -- searches man pages !or all commands %ith the key%ord =us'>
! you dont see any output !rom the man -k command# might need to run the maewhatis command to
inde* the man pages
"nfo whoami -- prints easy to read description o! the command
Help echo
#ho - displays the users %ho are currently logged into the system
Shutdown -h +$ -- halts system in + minutes
Shutdown -% +$ -- re'oots system in + minutes
Shutdown -h now -- halts system immediately
Shutdown -% now -- re'oots system immediately
Shutdown -c -- cancel a scheduled shutdo%n
Halt -- halts your system immediately
&owe%off -- halts your system immediately and po%ers do%n computer
'e!oot -- re'oots system immediately
Shutdown -c -- cancels shutdo%n
Shutdown -h now -- to halt your system no%
(t%l+alt+f) - opens 4"
Packages to standardi0e con!iguration !iles across .inu* systems -
2'S
Prompt root user receives - 9
Prompt regular users receive - :
7
rd
primary partition on the 2
nd
SCS hard disk %ithin .inu* - sd*$
)hich 2 partitions do you typically create during a 2edora installation-
)*oot
s3ap
/oot loader that is availa'le to choose !rom during 2edora linu* install - GRUB
(xploring 1in+x 'ile Systems
A'solute path - !ull pathname o! a !ile starting !rom root
&wd - to vie% system directory that you are currently %orking on
Print %orking directory
(d - change directory
(d /home
(d - returns to home directory i! destination not speci!ied
(d *ma%y - mary>s home directory
(d ++ - 1 step closer to parent directory
(d ++/++ - root
"se the ta' completion !eature o! the 'ash shell
Special device !iles are !ound in the /de, directory
Soc4et !ile - allo%s a process on another computer to %rite to a !ile on the local computer %hil%
another process reads !rom the !ile(
2ile names starting %ith a =/> are hidden !iles
Ls
Ls /home/!o!
Ls -- - displays list o! !iles and their types
B - linked !ile# C - e*ecuta'le !ile# $ - su' directory# D - socket# E - named pipe
Ls -l - long listing !or each !ile in a directory
Ls -a - to vie% hidden !iles
Ls -a- - to vie% all hidden !iles and their !ile types
. - matches 3 or more characters in a !ile name
/ - matches 1 character in a !ilename
0aegh1 - matches 1 character in a !ilename
Ls p%o2ect.
Ls p%o2ect/
Ls p%o2ect//
Ls p%o2ect0)341
(at p%o2ect$ - concatenation# to display entire te*t !ile on screen
(at -n p%o2ect$ - to display the line num'er o! each line
Tac p%o2ect$ - to display a !ile in reverse order
Head p%o2ect$ - i! !ile is very large and %ant to vie% !irst 13 lines
Head -3 p%o2ect$
Tail p%o2ect$ - displays the end o! te*t !iles
Tail -5 p%o2ect$
Mo%e p%o2ect4 - to display page 'y page# space'ar !or %hole page# enter !or ne*t line
less p%o2ect4
Ls -l 6 mo%e - i! output is too large to !it on the screen
Chapter + - .inu* 2ile system 5anagement

'ile System ;ierarcy Standard ,';S- - to simply!y the task o! !inding speci!ic !iles
Ls --
Mdi% p%o27files - to create a directory
Ls --
M, /etc/sample) /%oot - move source !ile$directory target !ile$directory
M, /etc/sample) /etc/sample5 /%oot - moving 2 !iles to root
M, p%o2ect. p%o27files - move all !iles starting %ith the %ord pro8ect to pro8F!iles
Ls --
Ls -- p%o27files
"se move command to rename !iles
M, mysc%ipt mysc%ipt5
Ls --
Cp ,copy- command keeps the !ile that is in the source directory
. - speci!ies current directory
.. - speci!ies parent directory
(p /etc/hosts +
(p hosts hosts5 -- making a copy o! hosts into the current directory
Ls --
-R - recursive copy# to copy a directory !ull o! !iles
(p p%o27files /home
Ls -- /home/use%)
(p -' p%o27files /home
Ls -- /home/use%)
Ls --
M, hosts hosts5
M, -f hosts hosts5 -- -! is !orce option
Ls --
Ls -f
'm cu%%ent -- remove command
'm -f hosts5
'mdi% p%o27files -- removes directory
Pro8F!iles:directory is not empty
'm -'f p%o27files
Ls --
-% and -' ha,e same meaning - 'ecu%si,e
-' option nown as %esume option - dangerous i! you are not certain %hich !iles
E*ist in the directory

2inding !iles - using the locate command
Locate initta!
Loc8te initta! 6 mo%e -- to make the output easier to read
Slo%er 'ut more versatile command is the find command
-ind /etc -name initta!
Echo $&9TH -- the path varia'le lists directories that are searched !or e*ecuta'le !iles
! a relative or a'solute pathname %as not speci!ied %hen e*ecuting a command on the command line(
#hich g%ep -- to search the directories in the PATH varia'le !or the !ile called GgrepH
Iou could use the %ord grep as an argument
CHAPTER J - /ASH SHE..
7 !ile descriptors - stdin# stdout and stderr
Stdin - 3# stdout - 1# stderr - 2
K - Redirection sym'ol
To redirect stdout -
Ls /etc/hosts/ etc/h ):goodoutput -- redirecting output to a !ile called goodoutput
To see that stdout %as redirected to goodoutput -
Ls --
(at goodoutput
Ls /etc/hosts/ etc/h 5:!adoutput
(at !adoutput
/ecause redirecting stdout to a !ile is more common than redirecting stderr# the /ASH
Shell assumes stdout %ithout a numeric !ile descriptor
Ls /etc/hosts/ etc/h ):goodoutput
Ls /etc/hosts/ etc/h ):goodoutput 5:!adoutput
To redirect stdout and stderr to the same !ile %ithout loss o! data:
Ls /etc/hosts/ etc/h ):goodoutput 5:;)
(at goodoutput
Stderr sent to 'adoutput and stdout to same place as stderr
Ls /etc/hosts/ etc/h 5:!adoutput :;5
(at !adoutput
<ate :dateoutput
(at dateoutput
To prevent the !ile !rom 'eing cleared 'y the /ASH shell and append output
To the e*isting !ile# speci!y 2 KK characters
<ate :dateoutput
(at dateoutput
<ate ::dateoutput
(at dateoutput
To redirect a !ile to the stdin o! a command use the L shell:
(at =/etc/issue
To translate all the lo%ercase r characters in the $etc$issue !ile to uppercase R characters:
T% % '=/etc/issue
To save a copy o! the stdout !or later use# you can use stdin and stdout redirection together:
T% % ' =/etc/issue:newissue
(at newissue
As %ith redirecting stdout and stderr in the same command# you should use di!!erent !ile names
)hen redirecting stdin and stdout(
So%t =newissue :newissue
(at newissue
The ne%issue !ile has no contents %hen displayed in the output(
Pipes
Redirection occurs 'et%een a command and a !ile
Iou can use a pipe to send the stdout o! one command to another command as stdin
(omand)6command5
Ls -l /etc 6 less -- the stdout o! ls -l is too large to !it on the screen# so you can send
t to the less command# %hich vie%s stdin page 'y page
Mount 6 g%ep /de,/sda -- to vie% lines that contain in!ormation regarding !ile systems
5ounted !rom the 1
st
SATA hard disk ,$dev$sda-# you could send the stdout o! the mount command to
the grep command as stdin(
.s and mount are not !ilter commands# so must 'e at the 'eginning o! a pipe(
:ther commands such as vi are interactive# 'ecause they cannot take !rom stdin and give to stdout(

You might also like