You are on page 1of 52

1.What is the best RAID level?

RAID 0 for performance


RAID 5 for High availability
RAID 6 even better High Availability if the b!get is fine
".What is #A$ a!!ress an! Ho% to chec& the #A$ a!!ress in lin'?
A mac a!!ress means me!ia access control a!!ress.It is a ni(e a!!ress assigne! to
almost all net%or&ing har!%are sch as )thernet car!s* roter etc.
#ost layer " net%or& protocols se one of three nmbering spaces %hich are !esigne!
to be globally ni(e.
+in' $omman! to see #A$ a!!ress,
Ifconfig is se! to configre net%or& interfaces.
- .sbin.ifconfig grep HWa!!r
/tpt, eth0 +in& encap,)thernet HWa!!r 00,00,)A,11,02,03
/R
- .sbin.ifconfig
eth0 +in& encap,)thernet HWa!!r 00,00,)A,11,02,03 444 5HI6 I6 5H) #A$
ADDR)66
inet a!!r,11".167.1.1 8cast,11".167.1."55 #as&,"55."55."55.0
inet6 a!!r, fe70,,"0f,eaff,fe11,203.62 6cope,+in&
/R as a root ser type follo%ing comman!,
9 grep eth0 .var.log.!mesg
eth0, Real5e& R5+71:1 at 0'c000* 00,0f,ea,11,02,03* IR; 17 444 this line " component
from this si!e is #A$ a!!ress
eth0, I!entifie! 71:1 chip type <R5+=71008.71:1D<
eth0, lin& p* 100#bps* fll=!ple'* lpa 0'25)1
:.ho% to assign a permanent I> to a client %hich is presently in DH$> in +in'?
.sbin.ifconfig eth0 11".167.10.1 netmas& "55."55."55.0 broa!cast 11".167.10."55
In this comman! %e are assigning 11".167.10.1 I> to ethernet interface?@I$ car!A eth0.
Also in re!hat lin' terminal yo can type coman! BsetpB C lanch a WiDar! type
interface in %hich can choose net%or& C configre I>
Eo can se the FGI tool .sr.bin.neat = Fnome FGI net%or& a!ministration tool. It
han!les all interfaces an! configres for both static assignment as %ell as !ynamic
assignment sing DH$>.
2. Ho% to e'cl!e some ip a!!ress range in DH$>?
5o e'cl!e the range of I> a!!ress in a sbnet is to split the a!!ress range of sbnet
into t%o.
)'ample,
sbnet 1.1.1.0 netmas& "55."55."55.0
H
range 1.1.1.10 1.1.1.15
range 1.1.1."1 1.1.1.20
I
so in the above e'ample atomatically the I> 16="0 %ill be e'cl!e! from the list.
5.What is the !efalt serial nmber of D@6 ?
Are base! on I6/ !ates. )very time the !ata in the !atabase is change!* the serial
nmber mst be increase! in or!er that the slave servers &no% the Done has change!
6.ho% to pll the !ata to the secon!ary nis server from master server?
yp'fr is a pll comman! %hich rns on each slave server to ma&e that server import the
map from master nis server
3.%hat file nee! to be change! in nis client if yo are changing the machine from one
sbnet%or& to other sbnet%or&?
.etc.yp.conf
7.ho% to see memory sage?
$omman!s BtopB an! Bfree =mB
1.ho% to increase the filesystem ?
Gsing comman! 9 f!is&
# As the system administrator you need to review Bobs cronjobs. What command would you
use? Choose one:
a. crontab =l bob
b. crontab = bob
c. crontab =l
!. cron( =l bob
# In order to schedule a cronjob, the irst tas! is to create a te"t ile containin# the jobs to be
run alon# with the time they are to run. Which o the ollowin# commands will run the scri$t
%y&cri$t every day at '':() $m? Choose one:
a. J ": 25 J J #y6cript
b. ": 25 J J J #y6cript
c. 25 ": J J J #y6cript
!. J J J ": 25 #y6cript
# Which daemon must be runnin# in order to have any scheduled jobs run as scheduled?
Choose one:
a. cron!
b. at!
c. atrn
!. crontab
# *ou want to ensure that your system is not overloaded with users runnin# multi$le
scheduled jobs. A $olicy has been established that only the system administrators can create
any scheduled jobs. It is your job to im$lement this $olicy. +ow are you #oin# to do this?
Choose one:
a. create an empty file calle! .etc.cron.!eny
b. create a file calle! .etc.cron.allo% %hich contains the names of those allo%e! to sche!le Kobs.
c. create a file calle! .etc.cron.!eny containing all reglar sernames.
!. create t%o empty files calle! .etc.cron.allo% an! .etc.cron.!eny
# *ou notice that your server load is e"ce$tionally hi#h durin# the hours o ', am to - noon.
When investi#atin# the cause, you sus$ect that it may be a cron job scheduled by one o
your users. What command can you use to determine i your sus$icions are correct? Choose
one:
a. crontab =
b. cron! =
c. crontab =l
!. cron! =l
# .ne o your users, Bob, has created a scri$t to reinde" his database. /ow he has it
scheduled to run every day at ',:0, am. What command should you use to delete this job.
Choose one:
a. crontab =r bob
b. crontab = bob
c. crontab =! bob
!. crontab =l bob
# What daemon is res$onsible or trac!in# events on your system?
# What is the name and $ath o the deault coni#uration ile used by the syslo#d daemon?
# *ou have made chan#es to the 1etc1syslo#.con ile. Which o the ollowin# commands will
cause these chan#es to be im$lemented without havin# to reboot your com$uter? Choose
one:
a. &ill 6IFHI@5 Lcat .var.rn.syslog!.pi!L
b. &ill 6IFHG> Lcat .var.rn.syslog!.pi!L
c. &ill 6IFHG> syslog!
!. &ill 6IFHI@5 syslog!
# Which o the ollowin# lines in your 1etc1syslo#.con ile will cause all critical messa#es to
be lo##ed to the ile 1var1lo#1critmessa#es? Choose one:
a. J.Mcrit .var.log.critmessages
b. Jcrit .var.log.critmessages
c. JMcrit .var.log.critmessages
!. J.crit .var.log.critmessages
# *ou wish to have all mail messa#es e"ce$t those o ty$e ino to the 1var1lo#1mailmessa#es
ile. Which o the ollowin# lines in your 1etc1syslo#d.con ile would accom$lish this? Choose
one:
a. mail.JNmailOMinfo .var.log.mailmessages
b. mail.JNmail.Minfo .var.log.mailmessages
c. mail.JNmail.info .var.log.mailmessages
!. mail.JNmail.OMinfo .var.log.mailmessages
# What is the name and $ath o the main system lo#?
# Which lo# contains inormation on currently lo##ed in users? Choose one:
a. .var.log.tmp
b. .var.log.%tmp
c. .var.log.lastlog
!. .var.log.messages
9 Eo have been assigne! the tas& of !etermining if there are any ser acconts !efine! on yor
system that have not been se! !ring the last three months. Which log file shol! yo e'amine to
!etermine this information? $hoose one,
a. .var.log.%tmp
b. .var.log.lastlog
c. .var.log.tmp
!. .var.log.messages
# *ou have been told to coni#ure a method o rotatin# lo# iles on your system. Which o the
ollowin# actors do you not need to consider? Choose one:
a. !ate an! time of messages
b. log siDe
c. fre(ency of rotation
!. amont of available !is& space
# What utility can you use to automate rotation o lo#s?
# *ou wish to rotate all your lo#s wee!ly e"ce$t or the 1var1lo#1wtm$ lo# which you wish to
rotate monthly. +ow could you accom$lish this. Choose one:
a. Assign a global option to rotate all logs %ee&ly an! a local option to rotate the .var.log.%tmp log
monthly.
b. Assign a local option to rotate all logs %ee&ly an! a global option to rotate the .var.log.%tmp log
monthly.
c. #ove the .var.log.%tmp log to a !ifferent !irectory. Rn logrotate against the ne% location.
!. $onfigre logrotate to not rotate the .var.log.%tmp log. Rotate it manally every month.
# *ou have coni#ured lo#rotate to rotate your lo#s wee!ly and !ee$ them or ei#ht wee!s.
*ou are runnin# our o dis! s$ace. What should you do? Choose one:
a. ;it sing logrotate an! manally save ol! logs to another location.
b. Reconfigre logrotate to only save logs for for %ee&s.
c. $onfigre logrotate to save ol! files to another location.
!. Gse the prerotate comman! to rn a script to move the ol!er logs to another location
> 1. You have 20 servers that need to be updated named
[...]
> Ans:
Yours is woefully unportable. For starters you !an"t rely on bash.
#e!ond you !an"t rely on $%&'spe!ifi! tools li(e se).
> for i in *se) 'w 20*
+f you"re usin, bash why add an e-tra shell invo!ation here.
for i in /01..200 should ,et the same effe!t in re!ent versions of
bash2.
> 2. 1ow do you findout whether a !ommand is an aliases bash fun!tion
> built'in li(e !d and type or e-e!utable pro,ram.
>
> Ans:
>
> type 'all your!md
2his is a,ain bash'spe!ifi!. All !ommon shells support the use of
whi!h 3either by builtin or in some !ases by whi!h3144 whi!h
will answer the same )uestion.
> 5. 6hat is a 7ombie pro!ess and how do you find them.
[...]
> ps 'au- will show all pro!esses. 8oo( for 9:9 in that stat and defun!t
> under the !ommand.
2hat answer"s in!omplete; that"s relyin, on <#= ps314 synta-. >n
#olaris at least you !an use ?usr?u!b?ps 3thou,h it"s )uite slow4
but on a true #ys@ system you"ll need to (now how to read ps 'ef
output as well.
Also <#= ps314 synta- has lon, depre!ated the use of the '.
> A. 1ow do you find the version of 8inu- runnin, and the version of ,!!
> used.
> Ans:
> !at ?pro!?version
6hy would you ,ive a 8inu-'spe!ifi! )uestion mu!h less answer on a
test for a &ni- sysadmin. 2he B>#+C way to ,et this information is
uname314.
> D. 1ow do you setup multiple +B address on one %+E 3%etwor( +nterfa!e
> Eard4...assume ethernet.
>
> Ans:
> %ormally ?et!?sys!onfi,?networ('s!ripts?if!f,'eth0 is the setup for the
> first !ard. 2o add additional +B addresses !reate another file
> 9if!f,'eth0:19 with the new +B address information in it.
2hat"s dis,ustin,ly 8inu-'spe!ifi!. <#= systems will use
?et!?if!onfi,.Ffoo>
> G. 6hat is an inode.
>
> Ans:
> 2he inode !ontains information about the file si7e file lo!ation
> ownership et!. Blus it !ontains a pointer to the first few blo!(s of data
> in the file.
2hat"s true but it ne,le!ts the F#'dependent implementation details
3sysadmins should be familiar at least with the file systems they
need to mana,e and should have a basi! understandin, of what desi,n
de!isions are made when desi,nin, a F#4 and ne,le!ts to as( the
important 9and why do you !are.9 pie!e of the )uestion.
> H. 6hat"s the differen!e between a hard lin( and a soft lin(.
6hy do people use the term 9soft lin(9. 2he !orre!t term is
9symboli! lin(9.
> Ans:
[...]
> fileA and file< have the same inode. 1ow do you (now this. +ssue the stat
> !ommand 9stat fileA9 and 9stat file<9.
stat314 isn"t defined in B>#+C but ls"s 'i fla, is.
> >ne important note about hard lin(s. Iditors li(e ema!s will !reate a new
> inode for a file. #o if you edit the file< above you won"t see the !han,es
> in fileA. +nstead that inode be!ames the ba!(up.
2hat"s a pretty irrelevant note + thin( unless you"re interested
in the internal fun!tionin,s of Ima!s. A salient point you ne,le!t
to mention is what (ind of lin(s one !an ma(e a!ross file system
boundaries.
> J. 1ow do you !reate a file that even root !an"t remove.
>
> Ans:
> You"t !an"t really; but the 9!hattr Ki file9 !ommand !an ma(e a file
> immutable. 2his file !an"t be removed until 9!hatt 'i file9 is performed.
> 2rue even root !an"t remove a file with the immutable attribute set. <ut
> root !an unset this attribute then delete the file.
!hattr314 isn"t Lust 8inu-'spe!ifi! it"s e-t/250'spe!ifi!. #ome
other file systems provide other ways of doin, this same thin,.
2he real answer to the )uestion is that you !reate the file and then
set a physi!al read'only mar(er on the devi!e itself 3tabs on floppy
dis(s and tape media Lumpers on dis( devi!es roMFhostname> in
dfstab?e-ports on an %F# server to whi!h the root user in )uestion
doesn"t have a!!ess4.
> N. 1ow do you find all the pro,rams and there lo!ation usin, so!(ets or
OOOOO
> pipes on your !omputer.
#pell!he!( is insuffi!ient. Broofread.
> Ans:
> 9netstat 'na9 will ,ive a list of listenin, !onne!tions; but it doesn"t do
> an ade)uate Lob of listin, the pro,rams. +nstead use
> 9lsof9
lsof is rather portable 3in that it !an be built on most if not
any B>#+C systems4 but many operatin, systems provide a native
me!hanism for this. 3<#= systems have fstat314 for instan!e.4
> >ther items to (now: 6hat is a superblo!( and what (ind of data is in it.
Pore importantly why would you need that information.
> +f someone tal(s about e-t2 and e-t5 filesystems what are they most li(ely
> runnin, =ebian or Qedhat.
+f someone tal(s about ufs what are they most li(ely usin, #un>#
or <#=?>#.
> &sin, the find !ommand how do you find all files
> with the immunitable attribute set.
$%&'find and e-t/250'spe!ifi!.
> 1ow do you !reate a dire!tory that"s sharable to a ,roup
A more ,eneral )uestion would as( what attributes !an be set in a
file"s mode bits and whi!h have spe!ial impli!ations for files that
are dire!tories or that are e-e!utable. >ne should also note that
!ertain popular file system implementations overload !ertain mode
bits; for e-ample #un"s ufs and be!ause of that @eritas"s v-fs.
I-plainin, whi!h of these intera!tions will fun!tion a!ross %F#
between same'># servers and !lients and different'># servers and
!lients would also be desirable.
> that by default will have ea!h file !reated as sharable to a ,roup.
2his presumes !han,es outside of the dire!tory"s mode bits. 3You
need to for!e a umas( on the users.4
> 6hat"s an effe!tive &+= and how is it set.
Qelatedly what"s a saved &+= and why would you !are about them.
> +s the speed of li,ht !onstant in a va!uum and does li,ht travel
> in a strai,ht line. Eareful on this last one..don"t let your formal
> edu!ation throw you off.
1eh.
>n #at Feb 1A 200A at 11:A5:DAAP '0D00 Ehris wrote:
> Are these )uestions supposed to be fo!used on a low end admin. >r a hi,h
> position admin.
2he former we !ertainly hope thou,h my e-perien!e di!tates that
people referrin, to themselves as senior !ouldn"t answer some of the
modifi!ations + made above.
+"ve atta!hed an in!omplete list of )uestions + would as( in an
interview for a senior &ni- and 8inu- systems administrator. 2hese
are based on a list of )uestions a friend of mine who prefers to
remain anonymous as(ed for my feedba!( on re!ently. +"ve made some
modifi!ations to that person"s )uestions and would prefer to ma(e
some si,nifi!ant additions before + made use of this list. 3Py
friend also had )uestions spe!ifi! to 6indows 2000; +"ve ellided
those here but if you"d li(e to see them let me (now.4
2here"s a si,nifi!ant la!( of file'system'related )uestions here
whi!h + pointed out to my friend at the time. 2he )uestions Pi(e
provided above aren"t a bad startin, point for that !omponent of
this list.
Py friend"s and my )uestions:
#ysadmin Rui7
2EB?+B %etwor(in,
' +n an +B networ( what is the fun!tion of a subnet mas(.
' #uppose you are assi,ned the E+=Q netblo!( 150.HJ.2D.GA?2J.
' 1ow many +B addresses are useable for hosts.
' 8ist them.
' Are there any +B addresses that are not useable for hosts.
' +f so list them with the reason that that spe!ifi! address
is not useable for hosts.
' 2he default ,ateway address on a subnet is !han,in,; the old
address is 1N2.1GJ.0.2DA and the new address is 1N2.1GJ.0.1.
6hat !han,es would you need to ma(e on a !omputer runnin, as a
=1EB server on that subnet. 32he =1EB server is not a!tin, as the
,ateway for this networ( and the system a!tin, as the ,ateway is
not re!eivin, its +B address from the =1EB server. Assume
whatever operatin, system and =1EB server software you"re
familiar with thou,h answers for a B>#+C operatin, system and
+#E dh!pd are preferred.4
' pin,314 reports 9Qe)uest timed out9 when tryin, to !he!(
!onne!tivity to a host but you"re able to a!!ess other servi!es
runnin, on the same system. $ive at least one possible
e-planation for this.
' 6hat should be found in the ?et!?hosts file. 3+f your answer
is spe!ifi! to any parti!ular ># please state that. Pore
spe!ifi! answers are preferred to more ,eneral ones.4
' #(et!h a brief history of the usa,e of this file in the &ni-
operatin, system3s4.
' 6hat is found in a =%# 7one file. 3Assume <+%= runnin, on a
B>#+C operatin, system.4
' 6hat is the purpose of an PC re!ord.
' 6hat data is permissable in a standards'!ompliant PC re!ord.
3Also a!!epted: what standards'non'!ompliant data is fre)uently
pla!ed in PC re!ords.4
' 6hat data is transferred in a =%# 7one transfer.
' +n what !ir!umstan!es would you permit systems outside of
your lo!al?!orporate networ( to perform =%# 7one transfers.
' +n what !ir!umstan!es would you not.
I'Pail
' I-plain in what ways ea!h of the +PAB B>B5 and #P2B proto!ols
are used.
' $ive at least two differen!es between +PAB and B>B5.
' I-plain at least one way that #P2B is used that does not
involve a mail user a,ent. 3<onus points for !reative
answers.4
' 6hat is an open mail relay.
' 1ow would you test an #P2B server to see if it is an open
mail relay.
' %ame at least two types of server pro!ess that !an be an open
mail relay but are not #P2B server pro!esses.
' 6hat are the basi! !ommands to send a messa,e to an #P2B server.
31int: <e,in with 1I8>.4
>#'level 2ools
' 6hat options to 3$%&4 tar314 would you use to de!ompress and
e-tra!t everythin, from an ar!hive named files.tar.,7
into the !urrent dire!tory.
' 1ow would you move a user"s home dire!tory from one mounted
dis( partition to another preservin, all file metadata with
minimal interruption to the user.
' Ean you do this with 7ero interruption to the user.
' 6hat !ommand would you use to !he!( available dis( spa!e on
all !urrently'mounted dis( partitions.
' 6hat !ommand3s4 with what options would you use to dis!over
whi!h dire!tory under a ,iven dis( partition was usin, the most
spa!e.
' 6hy is there an ?et!?shadow 3or similar differently'named4
file. 6hat is in it and how is it different from ?et!?passwd.
+"ll leave the answers as an e-er!ise for the reader sin!e you
should (now these thin,s by havin, learned them not by havin, read
a !heat'sheet.
''
,abriel rosen(oetter
,rSe!lipsed.net
T
T #ysadmin Rui7 2EB?+B %etwor(in, ' +n an +B networ( what is the
T fun!tion of a subnet mas(. ' #uppose you are assi,ned the E+=Q
T netblo!( 150.HJ.2D.GA?2J. ' 1ow many +B addresses are useable for
T hosts. ' 8ist them. ' Are there any +B addresses that are not
T useable for hosts. ' +f so list them with the reason that that
T spe!ifi! address is not useable for hosts. ' 2he default ,ateway
T address on a subnet is !han,in,; the old address is 1N2.1GJ.0.2DA
T and the new address is 1N2.1GJ.0.1. 6hat !han,es would you need to
T ma(e on a !omputer runnin, as a =1EB server on that subnet. 32he
T =1EB server is not a!tin, as the ,ateway for this networ( and the
T system a!tin, as the ,ateway is not re!eivin, its +B address from
T the =1EB server. Assume whatever operatin, system and =1EB server
T software you"re familiar with thou,h answers for a B>#+C operatin,
T system and +#E dh!pd are preferred.4 ' pin,314 reports 9Qe)uest
T timed out9 when tryin, to !he!( !onne!tivity to a host but you"re
T able to a!!ess other servi!es runnin, on the same system. $ive at
T least one possible e-planation for this. ' 6hat should be found in
T the ?et!?hosts file. 3+f your answer is spe!ifi! to any parti!ular
T ># please state that. Pore spe!ifi! answers are preferred to more
T ,eneral ones.4 ' #(et!h a brief history of the usa,e of this file
T in the &ni- operatin, system3s4. ' 6hat is found in a =%# 7one
T file. 3Assume <+%= runnin, on a B>#+C operatin, system.4 ' 6hat is
T the purpose of an PC re!ord. ' 6hat data is permissable in a
T standards'!ompliant PC re!ord. 3Also a!!epted: what
T standards'non'!ompliant data is fre)uently pla!ed in PC re!ords.4 '
T 6hat data is transferred in a =%# 7one transfer. ' +n what
T !ir!umstan!es would you permit systems outside of your
T lo!al?!orporate networ( to perform =%# 7one transfers. ' +n what
T !ir!umstan!es would you not. I'Pail ' I-plain in what ways ea!h of
T the +PAB B>B5 and #P2B proto!ols are used. ' $ive at least two
T differen!es between +PAB and B>B5. ' I-plain at least one way that
T #P2B is used that does not involve a mail user a,ent. 3<onus points
T for !reative answers.4 ' 6hat is an open mail relay. ' 1ow would
T you test an #P2B server to see if it is an open mail relay. ' %ame
T at least two types of server pro!ess that !an be an open mail relay
T but are not #P2B server pro!esses. ' 6hat are the basi! !ommands to
T send a messa,e to an #P2B server. 31int: <e,in with 1I8>.4 >#'level
T 2ools ' 6hat options to 3$%&4 tar314 would you use to de!ompress
T and e-tra!t everythin, from an ar!hive named files.tar.,7 into
T the !urrent dire!tory. ' 1ow would you move a user"s home
T dire!tory from one mounted dis( partition to another preservin,
T all file metadata with minimal interruption to the user. ' Ean you
T do this with 7ero interruption to the user. ' 6hat !ommand would
T you use to !he!( available dis( spa!e on all !urrently'mounted dis(
T partitions. ' 6hat !ommand3s4 with what options would you use to
T dis!over whi!h dire!tory under a ,iven dis( partition was usin, the
T most spa!e. ' 6hy is there an ?et!?shadow 3or similar
T differently'named4 file. 6hat is in it and how is it different
T from ?et!?passwd.
T
1ere"s a list of !ommon interview )uestions that +"ve !ome a!ross.
1. You have 20 servers that need to be updated named
server01server02...server20. 6rite a bash s!ript to update all the
!omputers assumin, they all use ssh with the a!!ount bo7o.
Ans:
UV?bin?bash
userM9bo7o9;
update!mdM9ls 'l9; U put in rpm !ommand here
errorfileM9updatelo,9;
for i in *se) 'w 20*
do
ssh 9W/user0SserverWi9 Wupdate!md TT e!ho 9Irror on server Wi >>
Werrorfile9;
done
2he !ommand se) 'w 20 pads with the ne!essary 7eros 3010205...0N4. 2he TT
e-e!utes only the left side on su!!ess. 1owever if the ssh fails the
ri,ht side is e-e!uted and an error messa,e to piped to the file.
2. 1ow do you findout whether a !ommand is an aliases bash fun!tion
built'in li(e !d and type or e-e!utable pro,ram.
Ans:
type 'all your!md
5. 6hat is a 7ombie pro!ess and how do you find them.
Ans:
6hen a pro!ess !reates a !hild pro!ess 9for(34 !ommand9 and that !hild
pro!ess terminates information about the !hild pro!ess 3EB& time memory
et!.4 e-ists for the parent to fet!h. 2he parent !an use the 9wait9 or
9waitpid9 to fet!h this si,nal. 2he !hild pro!ess be!omes a 7ombie as soon
as it finishes; but the #+$E18= hasn"t been !au,ht.
ps 'au- will show all pro!esses. 8oo( for 9:9 in that stat and defun!t
under the !ommand.
%ote: wait may still produ!e 7ombies. 2his !an happen of !hild A
terminates and it"s si,nal has been !au,ht. 6hile this si,nal is bein,
pro!ess !hild < terminates. #in!e these si,nals won"t )ueue !hild < !ould
stay in the 7ombie state. +t"s safer to use the waitpid !all.
A. 1ow do you find the version of 8inu- runnin, and the version of ,!!
used.
Ans:
!at ?pro!?version
D. 1ow do you setup multiple +B address on one %+E 3%etwor( +nterfa!e
Eard4...assume ethernet.
Ans:
%ormally ?et!?sys!onfi,?networ('s!ripts?if!f,'eth0 is the setup for the
first !ard. 2o add additional +B addresses !reate another file
9if!f,'eth0:19 with the new +B address information in it.
G. 6hat is an inode.
Ans:
2he inode !ontains information about the file si7e file lo!ation
ownership et!. Blus it !ontains a pointer to the first few blo!(s of data
in the file.
H. 6hat"s the differen!e between a hard lin( and a soft lin(.
Ans:
hard lin( is !reated by the followin, !ommand
Wln fileA file<
fileA and file< have the same inode. 1ow do you (now this. +ssue the stat
!ommand 9stat fileA9 and 9stat file<9.
soft lin( is !reated by the followin, !ommand
ln 's fileA fileE
1ere fileE has a different inode than fileA. 1owever this 9different
inode9 points to the same data as fileA.
>ne important note about hard lin(s. Iditors li(e ema!s will !reate a new
inode for a file. #o if you edit the file< above you won"t see the !han,es
in fileA. +nstead that inode be!ames the ba!(up.
J. 1ow do you !reate a file that even root !an"t remove.
Ans:
You"t !an"t really; but the 9!hattr Ki file9 !ommand !an ma(e a file
immutable. 2his file !an"t be removed until 9!hatt 'i file9 is performed.
2rue even root !an"t remove a file with the immutable attribute set. <ut
root !an unset this attribute then delete the file.
N. 1ow do you find all the pro,rams and there lo!ation usin, so!(ets or
pipes on your !omputer.
Ans:
9netstat 'na9 will ,ive a list of listenin, !onne!tions; but it doesn"t do
an ade)uate Lob of listin, the pro,rams. +nstead use
9lsof9
10. 1ow do you !reate dire!tory and subdire!tories when the parent dire!tory
may e-ist in one !ommand. +n other words !reate the followin, dire!tory
stru!ture.
?home?user?one?two
2he !ommand should wor( whether ?home?user e-ists or not.
Ans:
m(dir 'p ?home?user?one?two 2he 'p or 9parents9 ma(es the parent dire!tory
as needed.
Bersonal note: You want interviewers to as( ,ood )uestions. +f you ,et the
Lob it"s a si,n you"ll be wor(in, with (nowled,eable people. And if you
don"t ,et the Lob you"ll at least learn from the interview pro!ess.
>ther items to (now: 6hat is a superblo!( and what (ind of data is in it.
+f someone tal(s about e-t2 and e-t5 filesystems what are they most li(ely
runnin, =ebian or Qedhat. &sin, the find !ommand how do you find all files
with the immunitable attribute set. 1ow do you !reate a dire!tory that"s
sharable to a ,roup that by default will have ea!h file !reated as
sharable to a ,roup. 6hat"s an effe!tive &+= and how is it set. 1ow do you
pass and use a !ommand variable to an aw( s!ript. 1ow !an you easily print
)uotes in an aw( s!ript. &sin, a sed s!ript print only the data betwee
9Fstart>.....F?start>9 in a file. 1ow do you (eep !ron Lobs from sendin,
mail on output. 1ow do you !reate a E li(e for loop in <ash. 1ow do you
find the len,th of an array in bash. &sin, the find !ommand how do you find
dire!tory names that 9do not !ontain9 a parti!ular file. +s the speed of
li,ht !onstant in a va!uum and does li,ht travel in a strai,ht line.
Eareful on this last one..don"t let your formal edu!ation throw you off.
Qe,ards
Pi(e Ehiri!o
1. How are devices represented in UNIX?
All devices are represented by files called special files that are located in/dev directory.
Thus, device files and other files are named and accessed in the same way. A 'regular file' is
just an ordinary data file in the disk. A 'block special file' represents a device with
characteristics similar to a disk (data transfer in terms of blocks. A 'character special file'
represents a device with characteristics similar to a keyboard (data transfer is by stream of
bits in se!uential order.
2. What is 'inode'?
All "#$% files have its description stored in a structure called 'inode'. The inode contains info
about the file&si'e, its location, time of last access, time of last modification, permission and
so on. (irectories are also represented as files and have an associated inode. $n addition to
descriptions about the file, the inode contains pointers to the data blocks of the file. $f the
file is large, inode has indirect pointer to a block of pointers to additional data blocks (this
further aggregates for larger files. A block is typically )k.
$node consists of the following fields*
+ile owner identifier
+ile type
+ile access permissions
+ile access times
#umber of links
+ile si'e
,ocation of the file data
3. Brief about the director representation in UNIX
A "ni- directory is a file containing a correspondence between filenames and inodes. A
directory is a special file that the kernel maintains. .nly kernel modifies directories, but
processes can read directories. The contents of a directory are a list of filename and inode
number pairs. /hen new directories are created, kernel makes two entries named '.' (refers
to the directory itself and '..' (refers to parent directory.
0ystem call for creating directory is mkdir (pathname, mode.
1. /hat are the "ni- system calls for $/.2
open(pathname,flag,mode & open file
creat(pathname,mode & create file
close(filedes & close an open file
read(filedes,buffer,bytes & read data from an open file
write(filedes,buffer,bytes & write data to an open file
lseek(filedes,offset,from & position an open file
dup(filedes & duplicate an e-isting file descriptor
dup3(oldfd,newfd & duplicate to a desired file descriptor
fcntl(filedes,cmd,arg & change properties of an open file
ioctl(filedes,re!uest,arg & change the behaviour of an open file
The difference between fcntl anf ioctl is that the former is intended for any open file, while
the latter is for device&specific operations.
4. 5ow do you change +ile Access 6ermissions2
7very file has following attributes*
owner's user $( ( 89 bit integer
owner's group $( ( 89 bit integer
+ile access mode word
'r w x -r w x- r w x'
(user permission&group permission&others permission
r&read, w&write, -&e-ecute
To change the access mode, we use chmod(filename,mode.
7-ample 8*
To change mode of myfile to 'rw&rw&r:' (ie. read, write permission for user & read,write
permission for group & only read permission for others we give the args as*
chmod(myfile,;991 .
7ach operation is represented by discrete values
'r' is 4
'w' is 2
'x' is 1
Therefore, for 'rw' the value is 9(1<3.
7-ample 3*
To change mode of myfile to 'rw-r:r:' we give the args as*
chmod(myfile,0744).

9. /hat are links and symbolic links in "#$% file system2
A link is a second name (not a file for a file. ,inks can be used to assign more than one
name to a file, but cannot be used to assign a directory more than one name or link
filenames on different computers.
0ymbolic link 'is' a file that only contains the name of another file..peration on the symbolic
link is directed to the file pointed by the it.=oth the limitations of links are eliminated in
symbolic links.
>ommands for linking files are*
Link ln filename1 filename2
Symbolic link ln -s filename1 filename2
?. /hat is a +$+.2
+$+. are otherwise called as 'named pipes'. +$+. (first&in&first&out is a special file which is
said to be data transient. .nce data is read from named pipe, it cannot be read again. Also,
data can be read only in the order written. $t is used in interprocess communication where a
process writes to one end of the pipe (producer and the other reads from the other end
(consumer.
). 5ow do you create special files like named pipes and device files2
The system call mknod creates special files in the following se!uence.
8. kernel assigns new inode,
3. sets the file type to indicate that the file is a pipe, directory or special file,
@. $f it is a device file, it makes the other entries like major, minor device numbers.
+or e-ample*
$f the device is a disk, major device number refers to the disk controller and minor device
number is the disk.
A. (iscuss the mount and unmount system calls
The privileged mount system call is used to attach a file system to a directory of another file
systemB the unmount system call detaches a file system. /hen you mount another file
system on to your directory, you are essentially splicing one directory tree onto a branch in
another directory tree. The first argument to mount call is the mount point, that is , a
directory in the current file naming system. The second argument is the file system to
mount to that point. /hen you insert a cdrom to your uni- system's drive, the file system in
the cdrom automatically mounts to /dev/cdrom in your system.
8;. 5ow does the inode map to data block of a file2
$node has 8@ block addresses. The first 8; are direct block addresses of the first 8; data
blocks in the file. The 88th address points to a one&level inde- block. The 83th address
points to a two&level (double in&direction inde- block. The 8@th address points to a three&
level(triple in&directioninde- block. This provides a very large ma-imum file si'e with
efficient access to large files, but also small files are accessed directly in one disk read.
88. /hat is a shell2
A shell is an interactive user interface to an operating system services that allows an user to
enter commands as character strings or through a graphical user interface. The shell
converts them to system calls to the .0 or forks off a process to e-ecute the command.
0ystem call results and other information from the .0 are presented to the user through an
interactive interface. >ommonly used shells are sh,csh,ks etc.
83. =rief about the initial process se!uence while the system boots up.
/hile booting, special process called the 'swapper' or 'scheduler' is created with 6rocess&$(
;. The swapper manages memory allocation for processes and influences >6" allocation.
The swapper inturn creates @ children*
the process dispatcher,
vhand and
dbflush
with $(s 8,3 and @ respectively.
This is done by e-ecuting the file /etc/init. 6rocess dispatcher gives birth to the shell. "ni-
keeps track of all the processes in an internal data structure called the 6rocess Table (listing
command is ps &el.
8@. /hat are various $(s associated with a process2
"ni- identifies each process with a uni!ue integer called 6rocess$(. The process that
e-ecutes the re!uest for creation of a process is called the 'parent process' whose 6$( is
'6arent 6rocess $('. 7very process is associated with a particular user called the 'owner' who
has privileges over the process. The identification for the user is '"ser$('. .wner is the user
who e-ecutes the process. 6rocess also has '7ffective "ser $(' which determines the access
privileges for accessing resources like files.
getpid( &process id
getppid( &parent process id
getuid( &user id
geteuid( &effective user id
81. 7-plain fork( system call.
The Cfork(' used to create a new process from an e-isting process. The new process is
called the child process, and the e-isting process is called the parent. /e can tell which is
which by checking the return value from Cfork('. The parent gets the child's pid returned to
him, but the child gets ; returned to him.
84. 6redict the output of the following program code
main()
{
fork();
printf("Hello World!");
}
Answer*
Hello World!Hello World!
7-planation*
The fork creates a child that is a duplicate of the parent process. The child begins from the
fork(.All the statements after the call to fork( will be e-ecuted twice.(once by the parent
process and other by child. The statement before fork( is e-ecuted only by the parent
process.
89. 6redict the output of the following program code
main()
{
fork(); fork(); fork();
printf("Hello World!");
}
Answer*
D5ello /orldD will be printed ) times.
7-planation*
3En times where n is the number of calls to fork(
8?. ,ist the system calls used for process management*
0ystem calls (escription
fork( To create a new process
e-ec( To e-ecute a new program in a process
wait( To wait until a created process completes its e-ecution
e-it( To e-it from a process e-ecution
getpid( To get a process identifier of the current process
getppid( To get parent process identifier
nice( To bias the e-isting priority of a process
brk( To increase/decrease the data segment si'e of a process.
8). 5ow can you get/set an environment variable from a program2
Fetting the value of an environment variable is done by using Cgetenv('. 0etting the value
of an environment variable is done by using Cputenv('.
8A. 5ow can a parent and child process communicate2
A parent and child can communicate through any of the normal inter&process
communication schemes (pipes, sockets, message !ueues, shared memory, but also have
some special ways to communicate that take advantage of their relationship as a parent and
child. .ne of the most obvious is that the parent can get the e-it status of the child.
3;. /hat is a 'ombie2
/hen a program forks and the child finishes before the parent, the kernel still keeps some
of its information about the child in case the parent might need it & for e-ample, the parent
may need to check the child's e-it status. To be able to get this information, the parent calls
Cwait('B $n the interval between the child terminating and the parent calling Cwait(', the
child is said to be a C'ombie' ($f you do Cps', the child will have a CG' in its status field to
indicate this.
38. /hat are the process states in "ni-2
As a process e-ecutes it changes state according to its circumstances. "ni- processes have
the following states*
Hunning * The process is either running or it is ready to run .
/aiting * The process is waiting for an event or for a resource.
0topped * The process has been stopped, usually by receiving a signal.
Gombie * The process is dead but have not been removed from the process table.
/hat command should you use to check your filesystem2
Answer* fsck
The fsck command is used to check the integrity of the filesystem on your disk.
Iou want to print out a te-t file called vacations however the lines are of varying length. /hat te-t filter
could you use to even out the length of the lines2
Answer* fmt
The fmt te-t utility attempts to make all the lines the same lenght by joining or splitting lines.
Iou need to locate a file called salesdata that one of your userJs created in his home directory but you do
not know which one. 5ow could you use the find command to locate this file2
Answer* find /home &name salesdata
/hen using the find command to locate a file by name you must specify the starting place in the directory
heirarchy and the &name option to specify the file to search for.
/hat command would you type to use the cpio to create a backup called backup.cpio of all the usersJ home
directories2
Answer* find /home K cpio &o L backup.cpio
The find command is used to create a list of the files and directories contained in home. This list is then
piped to the cpio utility as a list of files to include and the output is saved to a file called backup.cpio.
Iou want to create a compressed backup of the usersJ home directories so you issue the command g'ip
/home/M backup.g' but it fails. The reason that it failed is that g'ip will only compress one NNNNNNN at a
time.
Answer* file
The g'ip utility cannot compress multiple files in a single operation.
Iou have three files in the /home/ben/memos directory called letters, tom, betty. 5ow could you determine
each fileJs type by issuing only one command2
Answer* file letters tom betty
The file utility will display the fileJs type for each filename that is passed as an argument.
$n order to display the last five commands you have entered using the fc command, you would type
NNNNNNNNNNN.
Answer* fc &4
The fc command can be used to edit or rerun commands you have previously entered. To specify the
number of commands to list, use &n.
7ach command has two types of output. There are standard output and standard NNNNNNNNNN.
Answer* error
=y default, each command sends its result as standard output and any error messages as standard error.
/hat can you type at a command line to determine which shell you are using2
Answer* echo O057,,
The name and path to the shell you are using is saved to the 057,, environment variable. Iou can then use
the echo command to print out the value of any variable by preceding the variableJs name with O. Therefore,
typing echo O057,, will display the name of your shell.
/hat type of local file server can you use to provide the distribution installation materials to the new
machine during a network installation2
A $netd
= +00T#(
> (#0
( ##T6
7 #+0
Answer* 7 : Iou can use an #+0 server to provide the distribution installation materials to the machine on
which you are performing the installation. Answers a, b, c, and d are all valid items but none of them are file
servers. $netd is the superdaemon which controls all intermittently used network services. The +00T#( is
the ,inu- +ile 0ystem 0tandard. (#0 provides domain name resolution, and ##T6 is the transfer protocol
for usenet news.
/hat would you type to send the last 3; lines of a te-t file to 0T($#2
A end &n 3; filename
= last &n 3; filename
> head &3; filename
( end &3; filename
7 tail &3; filename
Answer* 7 : "se the command tail &3; filename to see the last 3; lines of a file. The answers for a and d
both point to an invalid command. The answer for b points to a valid command. Typing this answer in with a
valid file name will even give you some output. 5owever, the last command tells you who is logged in, it
does not actually list the contents of any file named in the command. The answer for c, the head command,
is used to look at the beginning of a file, not the end.
/hich command works in almost all distributions to create a boot disk2
A mkboot
= make bootdsk
> make boot
( mkbootdsk
7 mkbootdisk
Answer* 7 : The mkbootdisk command creates a boot disk. Answers b and c are incorrect. The make
package is used to compile software, not create boot disks. Answers a and d point to invalid commands.
/hich command do you use to change runlevels2
A initlevel
= runlevel
> level
( run
7 init
Answer* 7 : The command used to change runlevels is init. Answers a, c, and d point to invalid commands.
Answer b is a valid command, but does not set the current runlevel. The runlevel command displays the
current runlevel, and the one that was used directly before entering this one.
Iou have a new, empty hard drive that you will use for ,inu-. /hat is the first step you use.
>hoose one*
a. >reate an e-tended partition to be used for data.
b. +ormat the hard drive to use the e-t3 filesystem.
c. >reate a swap partition of type )3.
d. >reate a primary partition using fdisk.
Answer* d
Iou must always first create a primary partition. .perating systems, including ,inu-, can only be booted
from a primary partition.
Iou have configured logrotate to rotate your logs weekly and keep them for eight weeks. Iou are running
our of disk space. /hat should you do2
>hoose one*
a. Puit using logrotate and manually save old logs to another location.
b. Heconfigure logrotate to only save logs for four weeks.
c. >onfigure logrotate to save old files to another location.
d. "se the prerotate command to run a script to move the older logs to another location.
Answer* d
Iou can use the prerotate command to run a script before logs are rotated. Iou could have this script move
the older logs to another location before rotation occurs.
$f you type the command cat dog QL cat what would you see on your display2
>hoose one*
a. Any error messages only.
b. The contents of the file dog.
c. The contents of the file dog and any error messages.
d. #othing as all output is saved to the file cat.
Answer* d
/hen you use QL for redirection, it redirects both the standard output and standard error. The output would
be saved to the file cat.
Iou have a directory with the following permissions
drw&rw:w& 8 root admin ?3;3 0ep 8? A*8; administration
and need to give everyone e-cept root read only access to it. /hich of the following commands will
accomplish this2
>hoose one*
a. chmod uoRr administration
b. chmod ug<r administration
c. chmod uo<r administration
d. chmod ugRr administration
Answer* d
/hen using symbols, the e!ual sign e-plicitly sets permissions and revokes any pre&e-isting permissions.
Iou want to know how much space is being occupied by your userJs home directories. /hich of the following
will provide you with this information2
>hoose one*
a. du &l /home
b. du &b /home
c. du &m /home
d. du &c /home
Answer* d
"sing the &c option with the du command will show the grand total of used space for the designated
directory.
Iou have entered the following cronjob. /hen will it run2 84 M M M 8,@,4 myscript
>hoose one*
a. at 84 minutes after every hour on the 8st, @rd and 4th of each month.
b. at 8*84 am, @*84 am, and 4*84 am every day
c. at @*;; pm on the 8st, @rd, and 4th of each month
d. at 84 minutes after every hour every Sonday, /ednesday, and +riday
Answer* d
This would run at 84 minutes after the hour on every Sonday, /ednesday, and +riday of every month no
matter what the date.
Iou need to see the last fifteen lines of the files dog, cat and
horse. /hat command should you use2
Answer* tail &84 dog cat horse
The tail utility displays the end of a file. The &84 tells tail to
display the last fifteen lines of each specified file.
/ho owns the data dictionary2
Answer* The 0I0 user owns the data dictionary. The 0I0 and 0I0T7S
users are created when the database is created.
Iou routinely compress old log files. Iou now need to e-amine a log
from two months ago. $n order to view its contents without first
having to decompress it, use the NNNNNNNNN utility.
Answer* 'cat
The 'cat utility allows you to e-amine the contents of a compressed
file much the same way that cat displays a file.
Iou suspect that you have two commands with the same name as the
command is not producing the e-pected results. /hat command can you
use to determine the location of the command being run2
Answer* which
The which command searches your path until it finds a command that
matches the command you are looking for and displays its full path.
Iou locate a command in the /bin directory but do not know what it
does. /hat command can you use to determine its purpose.
Answer* whatis
The whatis command displays a summary line from the man page for the
specified command.
Iou wish to create a link to the /data directory in bobJs home
directory so you issue the command ln /data /home/bob/datalink but the
command fails. /hat option should you use in this command line to be
successful.
Answer* "se the &+ option
$n order to create a link to a directory you must use the &+ option.
/hen you issue the command ls &l, the first character of the
resulting display represents the fileJs NNNNNNNNNNN.
Answer* type
The first character of the permission block designates the type of
file that is being displayed.
/hat utility can you use to show a dynamic listing of running processes2
Answer* top
The top utility shows a listing of all running processes that is
dynamically updated.
/here is standard output usually directed2
Answer* to the screen or display
=y default, your shell directs standard output to your screen or display.
Iou want to create a compressed backup of the usersJ home
directories. /hat utility should you use2
Answer* tar
Iou can use the ' modifier with tar to compress your archive at the
same time as creating it.
Iou wish to restore the file memo.ben which was backed up in the
tarfile Sy=ackup.tar. /hat command should you type2
Answer* tar -f Sy=ackup.tar memo.ben
This command uses the - switch to e-tract a file. 5ere the file
memo.ben will be restored from the tarfile Sy=ackup.tar.
Iou need to view the contents of the tarfile called Sy=ackup.tar.
/hat command would you use2
Answer* tar tf Sy=ackup.tar
The t switch tells tar to display the contents and the f modifier
specifies which file to e-amine.
/hat daemon is responsible for tracking events on your system2
Answer* syslogd
The syslogd daemon is responsible for tracking system information and
saving it to specified log files.
Iou have a file called phonenos that is almost 1,;;; lines long.
/hat te-t filter can you use to split it into four pieces each 8,;;;
lines long2
Answer* split
The split te-t filter will divide files into e!ually si'ed pieces. The
default length of each piece is 8,;;; lines.
Iou would like to temporarily change your command line editor to be
vi. /hat command should you type to change it2
Answer* set &o vi
The set command is used to assign environment variables. $n this case,
you are instructing your shell to assign vi as your command line
editor. 5owever, once you log off and log back in you will return to
the previously defined command line editor.
/hat account is created when you install ,inu-2
Answer* root
/henever you install ,inu-, only one user account is created. This is
the superuser account also known as root.
/hat command should you use to check the number of files and disk
space used and each userJs defined !uotas2
Answer* rep!uota
The rep!uota command is used to get a report on the status of the
!uotas you have set including the amount of allocated space and amount
of used space.
$n order to run fsck on the root partition, the root partition must
be mounted as NNNNNNNNNNN.
Answer* readonly
Iou cannot run fsck on a partition that is mounted as read&write.
$n order to improve your systemJs security you decide to implement
shadow passwords. /hat command should you use2
Answer* pwconv
The pwconv command creates the file /etc/shadow and changes all
passwords to T-J in the /etc/passwd file.
=ob Armstrong, who has a username of boba, calls to tell you he
forgot his password. /hat command should you use to reset his command2
Answer* passwd boba
The passwd command is used to change your password. $f you do not
specify a username, your password will be changed.
/hen you look at the /etc/group file you see the group kmem listed.
0ince it does not own any files and no one is using it as a default
group, can you delete this group2
Answer* no
The kmem group manages direct access to kernel memory and is necessary
for your systemJs health.
/hat te-t filter can you use to display a multi&page file and place
numbers at the beginning of each line.
(ir>ontents
"sing the L will redirect the output of the ls /etc command to the
file (ir>ontents.
/hat file defines the levels of messages written to system log files2
Answer* kernel.h
To determine the various levels of messages that are defined on your
system, e-amine the kernel.h file.
Iou have two files each ten lines long. /hat te-t filter could you
use to combine the two files so that each line of the output contains
the corresponding line from each file2
Answer* join
The join te-t filter will display one line for each pair of input
lines from two files.
Iou have two files in two different directories with the same
inode. /hat type of link is involved2
U,8V B //:L
Answer* nl
The nl te-t filter will divide a file into logical pages and number each line.
Puestion The top utility can be used to change the priority of a
running process2 Another utility that can also be used to change
priority is NNNNNNNNNNN2
Answer* nice
=oth the top and nice utilities provide the capability to change the
priority of a running process.
$n order to apply a filesystem to your new partitions you must
format them. /hat command would you use to create the e-t3 filesystem2
Answer* mke3fs
The mke3fs command creates the new filesystem on your partition.
/hat command should you type to see all the files with an
e-tension of TmemJ listed in reverse alphabetical order in the
/home/ben/memos directory.
Answer* ls &r /home/ben/memos/M.mem
The &c option used with ls results in the files being listed in
chronological order. Iou can use wildcards with the ls command to
specify a pattern of filenames.
$n order to create a file called (ir>ontents containing the
contents of the /etc directory you would type NNNNNNNNNNNN.
Answer* ls /etc L (ir>ontents
"sing the L will redirect the output of the ls /etc command to the
file (ir>ontents.
/hat file defines the levels of messages written to system log files2
Answer* kernel.h
To determine the various levels of messages that are defined on your
system, e-amine the kernel.h file.
Iou have two files each ten lines long. /hat te-t filter could you
use to combine the two files so that each line of the output contains
the corresponding line from each file2
Answer* join
The join te-t filter will display one line for each pair of input
lines from two files.
Iou have two files in two different directories with the same
inode. /hat type of link is involved2
/interview&!uestions/type.asp2iTypeWu;;@d)@QoffsetWu;;@d3;
U,;V B ((XDmaD,X8,D
Linux JOB Interview questions.doc
61K View as HTML Scanning for viruses...
D,D8;b1)18;@aee;)8ADV V B ((XDceDVB //:L
Answer* hard
5ard links all have the same inode number, unlike symbolic links.
/hat command is used to remove the password assigned to a group2
Answer* gpasswd &r
The gpasswd command is used to change the password assigned to a
group. "se the &r option to remove the password from the group.
= System Administrator Interview Questions =
a[[PageOutline]]
This interview is meant to be used with some easier questions that aren't revealed
to the andidate be!orehand" These are to distinguish between e#$eriene and
%oogle !lueny"
This interview assumes use o! the ommandline& sine we don't 'ee$ gra$hial
environments on our servers"
== (asi navigation ==
) To dis$lay a list o! all manual $ages ontaining the 'eyword *date*& what
ommand would you ty$e+
) ,hat ommand will dis$lay the !irst several lines o! a !ile alled *-un'*+
== .sers and $ermissions $ratium ==
) /ig it so everything in the !older gets deleted tonight at 01$m" 2very night at
01$m"
== 3oal seurity ==
) 4ow do you !eel about 5sudo5+
) ,hat's the di!!erene between 5telnet5 and 5ssh5+ ,hat's a good use !or eah+
) 4ow do you ensure your users have hard6to6guess $asswords+
== 7ilesystem ==
) ,hat is the di!!erene between a symboli and hard lin'+ ,hen would you use
eah+
) I have a !ile named 56!r5" 4ow do I get rid o! it+
) ,hy did I -ust as' that question+
) To $artition or not+ 4ow+
) ,hat are /AI8 1& 0& 9& 1:0+ ,hat level would you use !or a web server and why+
A database server+

== 5;et5 ==
) 5ls 6l ;et5" ,hat is all this stu!!+
) <ou added a line to 5;et;aliases5& but it doesn't seem to be wor'ing" ,hy+
) <ou've reated a 5=o$e5 user to run >o$e under" 4ow do you seure it so
someone doesn't guess its $assword& log in with it& and mess with stu!!+
) (ring u$ 5;et;$asswd5" ,hat is all this -un'+
) ,hat are shadow $asswords+
== Proesses ==
) 4ow many $roesses are running on your mahine right now+
== Shells ==
) ?ame as many shells as you an"
) ,hat's your !avorite shell+ ,hy+
) ,rite a shell sri$t to a$$end *snor'* to the !ile *test* but only i! *test* already
e#ists"
) A user $er!ormed a 5d@ hmod ABB "5 be!ore logging out" ,hat $roblem ours
when he logs in the ne#t time& and what level o! $rivilege is required to orret the
$roblem+

== Startu$ ==
) 8esribe the boot $roess o! your !avorite 3inu# in as muh detail as you an"
) ,hat are runlevels+
== Soial ==
) 8esribe an e#$eriene you had with a di!!iult user"
) 4ow do you 'ee$ u$ with urrent tools and $raties+
) 4ow did you doument your wor' at your last -ob so someone else ould $i' u$
where you le!t o!!+
== Totally misellaneous ==
) ,hen debugging a ore in gdb& what does the ommand 5bt5 giveC ore memory&
hea$ usage& or alling sta'+
) A user om$lains the web site is slow" ,hat do you do+
== A$ahe ==
) 4ow do you rig A$ahe to start u$ on boot+
) A$ahe doesn't start u$ on boot& and the thing above he's out o'ay" 4ow do
you tra' down the $roblem+
) htt$C;;weblion"$su"edu;stu!!"html used to e#ist& but now it's moved to
htt$C;;weblion"$su"edu;-un'"html" ?ame as many ways as you an to get the old ./3
to still wor'" ,hih way is your !avorite+
) These ./3s used to e#istC htt$C;;weblion"$su"edu;a"html&
htt$C;;weblion"$su"edu;b"html& """& htt$C;;weblion"$su"edu;="html" (ut we want to
aess them !rom ./3s li'e theseC htt$C;;weblion"$su"edu;al$habet;a&
htt$C;;weblion"$su"edu;al$habet;b& """& htt$C;;weblion"$su"edu;al$habet;=" 4ow an
we $ull that o!! without renaming the !iles+
) 4ow do I tell i! the web site is busy right now+
/hat is the default /indow system / /indows manager used in ,inu-2
>ode*
C.or,
/hat command is used to list the contents of directory2
>ode*
ls
ls 'l
/hat command is used to list the top 8; files / directories si'e wise2
>ode*
for C in W3du 's X T sort 'nr T !ut 'f 24; do du 'hs WC ; done
/hat command is used to display a list of currently running processes2
>ode*
ps
top
pstree
p,rep
?pro! file system
/hat is a login shell2
A program get e-ecuted when a user logs into "#$% bo-. 7.g. bash, sh, ksh, csh
/hat is "$(2
"ser identification number which is assigned to each "#$% / ,inu- userB it may or may not
be uni!ue (uni!ue number is recommended to avoid security related issues. "$( and user
relationship defined in /etc/passswd file.
>ode*
man id
man users
man ,roups
/hat F$(2 /hat is 7"$(2 /hat 0"$(2 /hat is H"$(2
,inu- L Sore on "07H $(, 6assword, and Froup management
"nderstanding /etc/passwd file format
"nderstanding /etc/ shadow file
7-plain "ni- "ser security concept
6ermissions & chmod and chown
"ser groups & group management & user management
Head su, sudo man page
/hat 6$(2
6rocess identification numberB use ps command to see 6$(. $t is a number used by "ni-
kernels and /indows operating systems to identify a process.
7-plain process $( 'ero and process $( 82
All the idle task has process $( 'ero, and never e-its.
The init process, with process $( 8, which does nothing but wait around for its child
processes to die. "sually started for /etc/inittab
7-plain wheel group usage along with an e-ample2
>ode*
man su
/hat command is used to check a file system for errors2
>ode*
fs!(
fs!(.e-t5
fs!(.nfs
fs!(.e-t2
fs!(.vfat
fs!(.reiserfs
fs!(.msdos
$s ,inu- / "#$% file system case sensitive2 Five one e-ample
Ies, test.t-t and T70T.t-t are two different files
/hat file contains the list of drives that are mounted at boot2
/etc/fstab & ,inu- / .ther "#$% version
/etc/vfstab & 0olaris "#$%
7-plain the usage of the fourth field in /etc/fstab2
$t is formatted as a comma separated list of options. Head mount command man page for
all the option.
/hat is /etc/inittab file2 $n what file is the default run level defined2
0ystem Y init e-amines the '/etc/inittab' file for an 'initdefault' entry, which tells init
whether there is a default runlevel. init is the program on "ni- that spawns all other
processes. $t runs as a daemon and typically has 6$( 8.
>ode*
man init
!at ?et!?inittab
>ommon runlevle values on H57,
>ode*
0. 1alt
1. #in,le user mode
G. Qeboot
5. =efault te-t
D. =efault $&+
To check the current runlevel*
>ode*
who 'r
runlevel
/hat command is used to get help about command2 /hat command is used to read manual
page for a given command2
>ode*
info !ommand'name
man !ommand'name
!ommand'name 'h
!ommand'name ''help
/hat command form or symbol used to redirect output to a file2
"se the L symbol
>ode*
!ommand'name > output.t-t
"se the Z symbol to read input from a file
/hat is ssh2 0pecify ssh command synta- to e-ecute command over a T>6/$6 network2
005 is Application layer protocol which allows data to be e-changed over a secure channel
between two computers.
0shh & /ikipedia, the free encyclopedia
>ode*
ssh userSremote.bo- !ommand'name
7-plain steps for password less login2 5ow do you set&up 005 with (0A / H0A public key
authentication2
5owto ,inu- / "#$% setup 005 with (0A public key authentication (password less login
7-plain =0(&style init2
Head rc man page. There are no runlevelsB the 'rc' file determines how init is to be run.
Hunlevel & /ikipedia, the free encyclopedia
7-plain 0ys&Y style init2
Head init man page
Hunlevel & /ikipedia, the free encyclopedia
7-plain "ni- philosophy
"ni- philosophy description by The ,inu- $nformation 6roject (,$#+.
/hat is 6.0$%2 #ame 3 6.0$%&oriented operating systems2
6ortable .perating 0ystem $nterface is the collective name of a family of related standards
specified by the $777 to define the application programming interface (A6$. 56&"%, 0olaris,
A$% etc
,inu- and =0( not certified as 6.0$% but conform to standard.
7-plain Haw device and command s to configure Haw device
=lock device file that allows accessing a storage device such as a hard drive directly. +or
e-ample /dev/hda. "se commands
>ode*
m(nod
fdis(
m(fs
m(fs.e-t5
7-plain +ile descriptor
+ile descriptor & /ikipedia, the free encyclopedia
7-plain "ni- file types
(irectory
6ipes
+ifo
0ymbolic link
#amed pipe
0ocket
(evice file
(oor
Hegular file
7-plain inode, superblock and hard links
"nderstanding "#$% / ,inu- file system
7-plain "ni- domain socket
"ni- 0ockets
Sy0P, and many programs uses domain socket to make client / server communication.
"sually fast as compare to T>6/$6
7-plain "#$% software pipeline concept
0ee shell or bash man page
>ode*
!at ?et!?passwd T ,rep username
mount T ,rep !drom
7-plain %IG "ni- daemons
/here %IG can be any one of the following*
>ode*
init
httpd
dh!pd
lpd
nfsd
ntpd
syslo,d
ypbind
ftpd
telnetd
sshd
named
7-plain udev in [ernel 3.92
udev & /ikipedia, the free encyclopedia
7-plain 6rocess management and related commands
7-plain Semory management and related commands
/hat is .pen Froup standards2
0ecify seciaal usage for each one of the following file
/dev/null & 0end unwanted output
/dev/random & Handom number generation
/dev/'ero & >ache or (estroy data on a partition & dd ifR/dev/'ero ofR/dev/sdaA)
/hat is 07,inu-2
/rite a command to find all of the files which have been accessed within the last 8; days.
/hat is ,$,.2
/hat is Frub2
7-plain the difference between ,$,. and Frub
/hat is #+02
/hat is #AS7(2
/hat is Sy0P,(2
/hat is mys!l2
/hat is >Y02
/hy Iou 0houldn't "se the root ,ogin for everyday work2
(escribe the default partition scheme in Hedhat ,inu-2
(escribe the default partition scheme in 0olaris2 /hat is the slice number2
(escribe all default mount point2
/hat is boot block2
/hat is logical block2
(escribe the process for adding a new hard disk to "#$% bo-2
(escribe the process for adding a new hard disk to ,inu- bo-2
(escribe the process for adding a new hard disk to ,inu- ,YS to grow /home2
7-plain one major difference between a regular file system and a journaling file system2
(efine \+0
(efine "+0
5ow do you lock and unlock user account / password2
(escribe H6S and command to install / remove / update ,inu- system2
7-plain difference between rpm and up3date command.
7-plain difference between rpm and apt&get command.
7-plain difference between rpm and yum command.
(escribe usage for pkgadd, pkginfo and pkgchk command
5ow do you find files on "#$% or ,inu- system2
7-plain /etc/rc@.d
7-plain ntsysv or chkconfig command
5ow do you get rid of process if kill 6$( is not working for you2
/hat is the purpose of the command2
grep
sed
awk
ifconfig
netstat
df
du
prtvtoc
fdisk &l
umaks
getfacl
setfacl
sudo
fsck
probe&scsi
vmstat
7-plain ,YS
0D /hat is a superblock 2
3 /hat is a parity bit2
@ /hat is an inod2
1 7-plain top command 2
4 5ow to disable the root login in 005 2
9 use of sysctl command 2
? ,YS how to 2
(ifferent HA$( levels 2
0D /hat is a superblock 2
3 /hat is a parity bit2
@ /hat is an inod2
1 7-plain top command 2
4 5ow to disable the root login in 005 2
9 use of sysctl command 2
? ,YS how to 2
(ifferent HA$( levels 2
Linux admin interview questions
By admin | March 4, 2005
1. How do you take a single line of input fro the user in a shell script!
2. "rite a script to con#ert all $%& style 'ackslashes to ()*+ style slashes in a list of files.
,. "rite a regular e-pression .or sed script/ to replace all occurrences of the letter 0f1, followed 'y any nu'er
of characters, followed 'y the letter 0a1, followed 'y one or ore nueric characters, followed 'y the letter
0n1, and replace what1s found with the string 2()*+3.
4. "rite a script to list all the differences 'etween two directories.
5. "rite a progra in any language you choose, to re#erse a file.
4. "hat are the fields of the password file!
5. "hat does a plus at the 'eginning of a line in the password file signify!
6. (sing the an pages, find the correct ioctl to send console output to an ar'itrary pty.
7. "hat is an M+ record!
10. "hat is the pro coand on a &un that shows the &8&* de#ices!
11. "hat is the factory default &8&* target for 9de#9sd0!
12. "here is that #alue controlled!
1,. "hat happens to a child process that dies and has no parent process to wait for it and what1s 'ad a'out this!
14. "hat1s wrong with sendail! "hat would you fi-!
15. "hat coand do you run to check file syste consistency!
14. "hat1s wrong with running shutdown on a network!
15. "hat can 'e wrong with setuid scripts!
16. "hat #alue does spawn return!
17. "rite a script to send ail fro three other achines on the network to root at the achine you1re on. (se a
0here doc1, 'ut include in the ail essage the nae of the achine the ail is sent fro and the disk
utili:ation statistics on each achine!
20. "hy can1t root ;ust cd to soeone1s hoe directory and run a progra called a.out sitting there 'y typing
2a.out3, and why is this good!
21. "hat is the difference 'etween ($< and =8<!
22. "hat is $)&!
2,. "hat does nslookup do!
24. How do you create a swapfile!
25. How would you check the route ta'le on a workstation9ser#er!
24. How do you find which ypaster you are 'ound to!
25. How do you fi- a pro'le where a printer will cutoff anything o#er 1MB!
26. "hat is the largest file syste si:e in solaris! &un%&!
27. "hat are the different >?*$ le#els!
ho% to fin! the /s version an! architechtre?
cat .etc.isse an! cat .etc.re!hat=relase
name =r an! getconf +/@FP8I5
Descibe the lin' boot process?
ho% %ill start any process?
What are !ifferent rn levels?
%hen yo create a ser accont %hich files %ill be p!ate!?
.etc.pass%!*.etc.sha!o%*.etc.grops
%hat is stic&y bit an! %hat is seti! an! setgi!?
Ho% %ill yo !ebg !omain not resolving isse?
What is .htaccess in apache?
Ho% %ill yo chec& the consistency of the http!.conf file?
apachectl configtest
Ho% %ill incl!e a mo!le !ynamically in apache?
Ho% to fin! all the installe! mo!les in apache?
What is virtal hosting an! %hat are the !ifferent types an! %hich one is sefl?
%hat is !ns an! %hat are important files in !ns?
)'plain the !iffernt fiel!s in the name!.conf file?
ho% %ill yo configre !ns client?
Ho% %ill yo fin! the memory se! ?
free =m
for viral memory
vmstat
Ho% %ill yo fin! %hether a process is starte!?
top an! ps
%hat is nice an! renice in lin'?
%hat is selin' an! ho% it %ill effect !ifferent services?
What are files se! for configring net%or&?
.et.hosts
.etc.sysconfig.net%or&
.etc.sysconfig.net%or&Mscripts.ifcfg=eth0
%hat is the 6ynta' in .etc.resolv.conf file?
Ans,
!omain lfi'.co.&
nameserver 112.3".11".1
nameserver 112.3".11".:
What is the synta' in .etc.hosts file?
I>Pnmber @o!ePname Alias....
11:.115.:0.3 elsie.lfi'.co.& elsie
What are the !efalt filesystems available in lin'?
ho% %ill yo re!ce the logical volme siDe?
What is nfs an! %hat are the a!vantages an! !is a!vantages of nfs?
Ho% %ill yo fin! %hether a file is being se!?
lsof =i filename
6cenario base! (estions,
/nly one nfs client is not able to access nfs mont ho% %ill yo !ebg?
restrict a ftp ser to his home !irectory?he shol! not be able to vie% any other fol!ers e'cept his
home !irectoryA?
When yo trie! to access a %ebsite it %as not loa!e! complete! some icons %ere missing ho%
yo %ill fi' the isse?
Ans,5his may be case! !e the bro%ser
6o p!ate the plggins
reinstall the bro%ser
chec& if bro%ser compatibility
Ho% %ill yo fi' if ftp service is !o%n?
restart the 'inet! service
$hec& %hether ftp service is enable in 'inet! file in ples& it %as ftpPpsa if it is not enable it an!
restart 'inet!
chec& the logs .var.log.messages
%hat %ill be !aily tas&s for a system a!ministrator?
>ort nmber for ftp*!ns*!hcp*apache*pop:*imap*https?
Ho% ssh %or&s?
What are rsa an! !sa &eys?
What is s!o an! ho% %ill yo create s!o sers?
What is the !ifference bet%een ym an! rpm?
Ho% %ill yo installa pac&age sing rpm?
Ho% %ill yo pgra!e the lin' &ernel?
Ho% %ill fin! the %hich ports listening in yor system?
netstat =tlp Q grep listen
What ile deines the levels o messa#es written to system lo# iles?
&ernel.h
5o !etermine the varios levels of messages that are !efine! on yor system* e'amine the &ernel.h file.
What command is used to remove the $assword assi#ned to a #rou$?
gpass%! =r
5he gpass%! comman! is se! to change the pass%or! assigne! to a grop. Gse the =r option to remove
the pass%or! from the grop.
What command would you ty$e to use the c$io to create a bac!u$ called bac!u$.c$io o all the
users2 home directories?
fin! .home Q cpio =o R bac&p.cpio
5he fin! comman! is se! to create a list of the files an! !irectories containe! in home. 5his list is then
pipe! to the cpio tility as a list of files to incl!e an! the otpt is save! to a file calle! bac&p.cpio.
What can you ty$e at a command line to determine which shell you are usin#?
echo -6H)++
5he name an! path to the shell yo are sing is save! to the 6H)++ environment variable. Eo can then
se the echo comman! to print ot the vale of any variable by prece!ing the variable<s name %ith -.
5herefore* typing echo -6H)++ %ill !isplay the name of yor shell.
What ty$e o local ile server can you use to $rovide the distribution installation materials to the
new machine durin# a networ! installation?
A3 Inetd
B3 4&&5/6
C3 6/&
63 //57
83 /4&
) = Eo can se an @06 server to provi!e the !istribtion installation materials to the machine on %hich
yo are performing the installation. Ans%ers a* b* c* an! ! are all vali! items bt none of them are file
servers. Inet! is the sper!aemon %hich controls all intermittently se! net%or& services. 5he 0665@D is
the +in' 0ile 6ystem 6tan!ar!. D@6 provi!es !omain name resoltion* an! @@5> is the transfer
protocol for senet ne%s.
I you ty$e the command cat do# 9 : cat what would you see on your dis$lay? Choose one:
a. Any error messa#es only.
b. 5he contents o the ile do#.
c. 5he contents o the ile do# and any error messa#es.
d. /othin# as all out$ut is saved to the ile cat.
!
When yo se C R for re!irection* it re!irects both the stan!ar! otpt an! stan!ar! error. 5he otpt
%ol! be save! to the file cat.
*ou are coverin# or another system administrator and one o the users as!s you to restore a ile
or him. *ou locate the correct tarile by chec!in# the bac!u$ lo# but do not !now how the
directory structure was stored. What command can you use to determine this?
Choose one:
a. tar " tarile dirname
b. tar tv tarile ilename
c. tar ct tarile
d. tar tv tarile
!
5he t s%itch %ill list the files containe! in the tarfile. Gsing the v mo!ifier %ill !isplay the store! !irectory
strctre.
*ou have the 1var directory on its own $artition. *ou have run out o s$ace. What should you do?
Choose one:
a. ;econi#ure your system to not write to the lo# iles.
b. <se i$s to enlar#e the $artition.
c. 6elete all the lo# iles.
d. 6elete the $artition and recreate it with a lar#er si=e.
!
5he only %ay to enlarge a partition is to !elete it an! recreate it. Eo %ill then have to restore the
necessary files from bac&p.
*ou have a new a$$lication on a C6>;.% that you wish to install. What should your irst ste$ be?
Choose one:
a. ;ead the installation instructions on the C6>;.%.
b. <se the mount command to mount your C6>;.% as read>write.
c. <se the umount command to access your C6>;.%.
d. <se the mount command to mount your C6>;.% as read>only.
!
8efore yo can rea! any of the files containe! on the $D=R/#* yo mst first mont the $D=R/#.
When you create a new $artition, you need to desi#nate its si=e by deinin# the startin# and
endin# ?????????????.
cylin!ers
When creating a ne% partition yo mst first specify its starting cylin!er. Eo can then either specify its
siDe or the en!ing cylin!er.
1. 4ow do you ta'e a single line o! in$ut !rom the user in a shell sri$t+
E" ,rite a sri$t to onvert all 8OS style ba'slashes to .?IF style slashes in a list o! !iles"
G" ,rite a regular e#$ression Hor sed sri$tD to re$lae all ourrenes o! the letter I!J& !ollowed
by any number o! haraters& !ollowed by the letter IaJ& !ollowed by one or more numeri
haraters& !ollowed by the letter InJ& and re$lae whatJs !ound with the string K.?IFL"
B" ,rite a sri$t to list all the di!!erenes between two diretories"
9" ,rite a $rogram in any language you hoose& to reverse a !ile
A" ,hat are the !ields o! the $assword !ile+
M" ,hat does a $lus at the beginning o! a line in the $assword !ile signi!y+
N" .sing the man $ages& !ind the orret iotl to send onsole out$ut to an arbitrary $ty"
O" ,hat is an PF reord+
01" ,hat is the $rom ommand on a Sun that shows the SQSI devies+
00" ,hat is the !atory de!ault SQSI target !or ;dev;sd1+
0E" ,here is that value ontrolled+
0G" ,hat ha$$ens to a hild $roess that dies and has no $arent $roess to wait !or it and whatJs
bad about this+
0B" ,hatJs wrong with sendmail+ ,hat would you !i#+
09" ,hat ommand do you run to he' !ile system onsisteny+
0A" ,hatJs wrong with running shutdown on a networ'+
0M" ,hat an be wrong with setuid sri$ts+
0N" ,hat value does s$awn return+
0O" ,rite a sri$t to send mail !rom three other mahines on the networ' to root at the mahine
youJre on" .se a Ihere doJ& but inlude in the mail message the name o! the mahine the mail is
sent !rom and the dis' utili=ation statistis on eah mahine+
E1" ,hy anJt root -ust d to someoneJs home diretory and run a $rogram alled a"out sitting
there by ty$ing Ka"outL& and why is this good+
E0" ,hat is the di!!erene between .8P and TQP+
EE" ,hat is 8?S+
EG" ,hat does nsloo'u$ do+
EB" 4ow do you reate a swa$!ile+
E9" 4ow would you he' the route table on a wor'station;server+
EA" 4ow do you !ind whih y$master you are bound to+
EM" 4ow do you !i# a $roblem where a $rinter will uto!! anything over 0P(+
EN" ,hat is the largest !ile system si=e in solaris+ SunOS+
EO" ,hat are the di!!erent /AI8 levels+
0" Advantages;disadvantages o! sri$t vs om$iled $rogram"
E" ?ame a re$laement !or P4P;Perl;PySQ3;3inu#;A$ahe and show main di!!erenes"
G" ,hy have you hoosen suh a ombination o! $roduts+
B" 8i!!erenes between two last PySQ3 versions" ,hih one would you hoose and when;why+
9" Pain di!!erenes between A$ahe 0"# and E"#" ,hy is E"# not so $o$ular+ ,hih one would
you hoose and when;why+
A" ,hih 3inu# distros do you have e#$eriene with+
M" ,hih distro you $re!er+ ,hy+
N" ,hih tool would you use to u$date 8ebian ; Sla'ware ; /ed4at ; Pandra'e ; SuS2 +
O" <ouJre as'ed to write an A$ahe module" ,hat would you do+
01" ,hih tool do you $re!er !or A$ahe log re$orts+
00" <our $ort!olio" Heven a P4P guest boo' may wor' wellD
0E" ,hat does IrouteJ ommand do+
0G" 8i!!erenes between i$hains and i$tables"
0B" ,hatJs eth1& $$$1& wlan1& ttyS1& et"
09" ,hat are di!!erent diretories in ; !or+
0A" Partitioning sheme !or new webserver" ,hy+
inux interview - August 21, 2008 at 22:00 pm by Rajmeet Ghai
What is @inu" and why is it so $o$ular?
Answer > +in' is an operating system that ses G@IS li&e /perating system.......
<ni" interview Auestions with answers
Discss the mont an! nmont system calls* What are the process states in Gni'?* What is se of se! comman!?*
What is <ino!e<?*What are the Gni' system calls for I./?* Ho% are !evices represente! in G@IS?* 8rief abot the
!irectory representation in G@IS ......
What is @I@.?
Answer > +I+/ is +in' +oa!er is a boot loa!er for +in'. It is se! to loa! +in' into the memory an! start the
/perating system.......
What is the dierence between home directory and wor!in# directory?
Answer > Home !irectory is the !efalt %or&ing !irectory %hen a ser logs in. /n the other han!* %or&ing !irectory is
the serTs crrent !irectory.......
What is the dierence between internal and e"ternal commands?
Answer > Internal comman!s are comman!s that are alrea!y loa!e! in the system. 5hey can be e'ecte! any time
an! are in!epen!ent.......
8"$lain the dierence between a static library and a dynamic library.
Answer > 6tatic libraries are loa!e! %hen the program is compile! an! !ynamically=lin&e! libraries are loa!e! in
%hile......
What is @6?@IB;A;*?7A5+?
Answer > +DP+I8RAREP>A5H is an environment variable. It is se! for !ebgging a ne% library or a non stan!ar!
library.......
What is the ile server in @inu" server?
Answer > 0ile server is se! for file sharing. It enables the processes re(ire! fro sharing.......
What is @06? What is its prpose?
Answer > @06 is @et%or& 0ile system. It is a file system se! for sharing of files over a net%or&.......
Ho% !o I sen! email %ith lin'?
Answer > )mail can be sent in +in' sing the mail comman!. ......
)'plain R># ?Re! Hat >ac&age #anagerA featres.
Answer > R># is a pac&age managing system ?collection of tools to manage soft%are pac&agesA.......
What is Uernel? )'plain the tas& it performs.
Answer > Uernel is se! in G@IS li&e systems an! is consi!ere! to be the heart of the operating system.......
What is +in' 6hell? What is 6hell 6cript?
Answer > +in' shell is a ser interface se! for e'ecting the comman!s. 6hell is a program the ser......
What are >ipes? )'plain se of pipes.
Answer > A pipe is a chain of processes so that otpt of one process ?st!otA is fe! an inpt ?st!inA to another.......
)'plain trap comman!N shift $omman!* getopts comman! of lin'.
Answer > 5rap comman!, controls the action to be ta&en by the shell %hen a signal is receive!. ......
What 6tateless +in' server? What featre it offers?
Answer > A stateless +in' server is a centraliDe! server in %hich no state e'ists on the single %or&stations. ......
What !oes nsloo&p !o? )'plain its t%o mo!es.
Answer > @sloo&p is se! to fin! !etails relate! to a Domain name server. Details li&e I> a!!resses of a machine*
#S recor!s*......
What is 8ash 6hell?
Answer > 8ash is a free shell for G@IS. It is the !efalt shell for most G@IS systems. It has a combination of the $
an! Uorn shell featres. ......
)'plain some @et%or&=#onitoring 5ools in +in', ping* tracerote* tcp!mp* ntop
Answer > @et%or& monitoring tools are se! to monitor the net%or&* systems present on the net%or&* traffic etc.......
Ho% !oes the lin' file system %or&?
Answer > +in' file strctre is a tree li&e strctre. It starts from the root !irectory* represente! by <.<* an! then
e'pan!s into sb=!irectories.......
What are the process states in +in'?
Answer > >rocess states in +in'.......
What is a Dombie?
Answer > Vombie is a process state %hen the chil! !ies before the parent process. In this case the strctral
information of the process is still in the process table.......
)'plain each system calls se! for process management in lin'.
Answer > 6ystem calls se! for >rocess management......

Which cmman! is use! t chec" the number # #i$es an! !is" space use! an! the each user%s
!e#ine! &uta'
rep(ota comman! is se! to chec& the stats of the serTs (ota along %ith the !is& space an! nmber of files
se!. 5his comman! gives a smmary of the serTs (ota that ho% mch space an! files are left for the ser. )very
ser has a !efine! (ota in +in'. 5his is !one mainly for the secrity* as some sers have only limite! access to
files. 5his provi!es a secrity to the files from n%ante! access. 5he (ota can be given to a single ser or to a grop
of sers.
What is the name an! path # the main system $g'
8y !efalt the main system log is .var.log.messages. 5his file contains all the messages an! the script %ritten by the
ser. 8y !efalt all scripts are save! in this file. 5his is the stan!ar! system log file* %hich contains messages from all
system soft%are* non=&ernel boot isses* an! messages that go to <!mesg<. !mesg is a system file that is %ritten
pon system boot.
(w secure! is )inux' *xp$ain+
6ecrity is the most important aspect of an operating system. De to its ni(e athentication mo!le* +in' is
consi!ere! as more secre! than other operating systems. +in' consists of >A#. >A# is >lggable Athentication
#o!les. It provi!es a layer bet%een applications an! actal athentication mechanism. It is a library of loa!able
mo!les %hich are calle! by the application for athentication. It also allo%s the a!ministrator to control %hen a ser
can log in. All >A# applications are configre! in the !irectory B.etc.pam.!B or in a file B.etc.pam.confB. >A# is
controlle! sing the configration file or the configration !irectory.
,an )inux cmputer be ma!e a ruter s that severa$ machines may share a sing$e -nternet
cnnectin' (w'
Ees a +in' machine can be ma!e a roter. 5his is calle! BI> #as(era!e.B I> #as(era!e is a net%or&ing fnction
in +in' similar to the one=to=many ?1, #anyA @A5 ?@et%or& A!!ress 5ranslationA servers fon! in many commercial
fire%alls an! net%or& roters. 5he I> #as(era!e featre allo%s other BinternalB compters connecte! to this +in'
bo' ?via >>>* )thernet* etc.A to also reach the Internet as %ell. +in' I> #as(era!ing allo%s this fnctionality even if
the internal compters !o not have I> a!!resses.
5he I> mas(era!ing can be !one by the follo%ing steps,
1. 5he +in' >$ mst have an internet connection an! a connection to +A@. 5ypically* the +in' >$ has t%o net%or&
interfaces=an )thernet car! for the +A@ an! a !ial=p >>> connection to the Internet ?throgh an I6>A.
". All other systems on yor +A@ se the +in' >$ as the !efalt gate%ay for 5$>.I> net%or&ing. Gse the same I6>=
provi!e! D@6 a!!resses on all systems.
:. )nable I> for%ar!ing in the &ernel. 8y !efalt the I> for%ar!ing is not enable!. 5o ensre that I> for%ar!ing is
enable! %hen yo reboot yor system* place this comman! in the .etc.rc.!.rc.local file.
2. Rn .sbin.iptables=the I> pac&et filter a!ministration program=to set p the rles that enable the +in' >$ to
mas(era!e for yor +A@.
What is the minimum number # partitins yu nee! t insta$$ )inux'
#inimm " partitions are nee!e! for installing +in'. 5he one is . or root %hich contains all the files an! the other is
s%ap. +in' file system is fnction specific %hich means that files an! fol!ers are organiDe! accor!ing to their
fnctionality. 0or e'ample* all e'ectables are in one fol!er* all !evices in another* all libraries in another an! so on. .
or WrootT is the base of this file system. All the other fol!ers are n!er this one. . can be consi!er as $, .6%ap is a
partition that %ill be se! as virtal memory. If there is no more available RA# a +in' compter %ill se an area of
the har! !is&* calle! s%ap* to temporarily store !ata. In other %or!s it is a %ay of e'pan!ing yor compters RA#.
Which cmman! is use! t review bt messages'
!mesg comman! is se! to revie% boot messages. 5his comman! %ill !isplay system messages containe! in the
&ernel ring bffer. We can se this comman! imme!iately after booting to see boot messages. A ring bffer is a
bffer of fi'e! siDe for %hich any ne% !ata a!!e! to it over%rites the ol!est !ata in it. Its basic synta' is
!mesg XoptionsY
Invo&ing !mesg %ithot any of its options cases it to %rite all the &ernel messages to stan!ar! otpt. 5his sally
pro!ces far too many lines to fit into the !isplay screen all at once* an! ths only the final messages are visible.
Ho%ever* the otpt can be re!irecte! to the less comman! throgh the se of a pipe* thereby allo%ing the startp
messages to be vie%e! on one screen at a time
!mesg Q less
Which uti$ity is use! t ma"e autmate rtatin # a $g'
logrotate comman! is se! to ma&e atomate rotation of log.
6ynta' of the comman! is,
logrotate X=!vY X=fQY X=sQY configPfileZ
It allo%s atomatic rotation* compression* removal* an! mailing of log files. 5his comman! is mainly se! for rotating
an! compressing log files. 5his Kob is !one every !ay %hen a log file becomes too large. 5his comman! can also be
rn by giving on comman! line. We can !one force rotation by giving [f option %ith this comman! in comman! line.
5his comman! is also se! for mailing. We can give [m option for mailing %ith this comman!. 5his option ta&es t%o
argments one is sbKect an! other is recipient name.
What are the partitins create! n the mai$ server har! !rive'
5he main partitions are !one firstly %hich are root* s%ap an! boot partition. 8t for the mail server three !ifferent
partitions are also !one %hich are as follo%s,
1. .var.spool= 5his is !one so that if something goes %rong %ith the mail server or spool than the otpt cannot
overrn the file system.
". .tmp= ptting this on its o%n partition prevents any ser item or soft%are from overrnning the system files.
:. .home= ptting this on its o%n is sefl for system pgra!es or reinstalls. It allo% not to %ipe off the .home
hierarchy along %ith other areas.
What are the #ie$!s in the.etc.passw! #i$e'
It contains all the information of the sers %ho log into the system. It contains a list of the system<s acconts* giving
for each accont some sefl information li&e ser ID* grop ID* home !irectory* shell* etc. It shol! have general
rea! permission as many tilities* li&e ls se it to map ser IDs to ser names* bt %rite access only for the sperser
?rootA. 5he main fiel!s of .etc.pass%! file are,
1. Gsername, It is se! %hen ser logs in. It shol! be bet%een 1 an! :" characters in length.
". >ass%or!, An ' character in!icates that encrypte! pass%or! is store! in .etc.sha!o% file.
:. Gser ID ?GIDA, )ach ser mst be assigne! a ser ID ?GIDA. GID 0 ?DeroA is reserve! for root an! GIDs 1=11 are
reserve! for other pre!efine! acconts. 0rther GID 100=111 are reserve! by system for a!ministrative an! system
acconts.grops.
2. Frop ID ?FIDA, 5he primary grop ID ?store! in .etc.grop fileA
5. Gser ID Info, 5he comment fiel!. It allo% yo to a!! e'tra information abot the sers sch as ser<s fll name*
phone nmber etc. 5his fiel! se by finger comman!.
6. Home !irectory, 5he absolte path to the !irectory the ser %ill be in %hen they log in. If this !irectory !oes not
e'ists then sers !irectory becomes .
3. $omman!.shell, 5he absolte path of a comman! or shell ?.bin.bashA. 5ypically* this is a shell.
Which cmman!s are use! t set a prcessr-intensive jb t use $ess ,/0 time'
nice comman! is se! for changing priority of the Kobs.
6ynta', nice X/>5I/@Y X$/##A@D XARFY...Y
Range of priority goes from ="0 ?highest priorityA to 11 ?lo%estA.>riority is given to a Kob so that the most important Kob
is e'ecte! first by the &ernel an! then the other least important Kobs. 5his ta&es less $>G times as the Kobs are
sche!le! an! are given priorities so the $>G e'ectes fast. 5he priority is given by nmbers li&e ="0 !escribe the
highest priority an! 11 !escribe the least priority.
(w t change win!w manager by e!iting yur hme !irectry'
..'initrc file allo%s changing the %in!o% manager %e %ant to se %hen logging into S from that accont. 5he !ot in
the file name sho%s yo that the file is a hi!!en file an! !oesn<t sho% %hen yo !o a normal !irectory listing. 0or
setting a %in!o% manager %e have to save a comman! in this file. 5he synta' of comman! is, e'ec
%in!o%manager.After this* save the file. @e't time %hen yo rn a start' a ne% %in!o% manager %ill open an!
become !efalt. 5he comman!s for starting some poplar %in!o% managers an! !es&top environments are,
=UD) M start&!e
=Fnome M gnome=session
=8lac&bo' M blac&bo'
=0\W# M fv%m
=Win!o% #a&er M %ma&er
=IceW# M ice%m
(w !cumentatin # an app$icatin is stre!'
When a ne% application is installe! its !ocmentation is also installe!. 5his !ocmentation is store! n!er the
!irectory name! for application. 0or e'ample if my application name is App1 then the path of the !ocmentation %ill
be .ser.!oc.App1. It contains all the information abot the application. It contains !ate of creating application* name
of application an! other important mo!le of the application. We can get the basic information of application from the
!ocmentation.
(w sha!w passwr!s are given'
p%conv comman! is se! for giving sha!o% pass%or!s. 6ha!o% pass%or!s are given for better system secrity. 5he
p%conv comman! creates the file .etc.sha!o% an! changes all pass%or!s to W'T in the .etc.pass%! file. 0irst* entries
in the sha!o%e! file %hich !on<t e'ist in the main file are remove!. 5hen* sha!o%e! entries %hich !on<t have L'< as
the pass%or! in the main file are p!ate!. Any missing sha!o%e! entries are a!!e!. 0inally* pass%or!s in the main
file are replace! %ith L'<. 5hese programs can be se! for initial conversion as %ell to p!ate the sha!o%e! file if the
main file is e!ite! by han!.
(w ! yu create a new user accunt'
sera!! comman! is se! for creating a ne% ser accont. When invo&e! %ithot the
=D option* the sera!! comman! creates a ne% ser accont sing the vales specifie! on the comman! line an! the
!efalt vales from the system. 5he ne% ser accont %ill be entere! into the system files as nee!e!* an! initial files
copie!* !epen!ing on the comman! line options. 5his comman! ses the system !efalt as home !irectory. If [m
option is given then the home !irectory is ma!e.
Which passwr! pac"age is insta$$e! #r the security # centra$ passwr!'
6ha!o% pass%or! pac&ages are se! for secrity of central pass%or!s. 6ecrity is the most important aspect of
every operating system. When this pac&age is not installe! the ser information incl!ing pass%or!s is store! in
the .etc.pass%! file. 5he pass%or! is store! in an enco!e! format. 5hese enco!e! forms can be easily i!entifie! by
the 6ystem crac&ers by ran!omly enco!ing the pass%or!s from !ictionaries. 5he 6ha!o% >ac&age solves the
problem by relocating the pass%or!s to another file ?sally .etc.sha!o%A. 5he .etc.sha!o% file is set so that it cannot
be rea! by Kst anyone. /nly root %ill be able to rea! an! %rite to the .etc.sha!o% file.
Which she$$ ! yu assign t a /1/2 mai$-n$y accunt'
>/>: mail only accont is assigne! to the .bin.false shell. Ho%ever* assigning bash shell to a >/>: mail only gives
ser login access* %hich is avoi!e!. .bin.nologin can also be se!. 5his shell is provi!e! to the ser %hen %e !onTt
%ant to give shell access to the ser. 5he ser cannot access the shell an! it reKect shell login on the server li&e on
telnet. It is mainly for the secrity of the shells. >/>: is basically se! for !o%nloa!ing mail to mail program. 6o for
illegal !o%nloa!ing of emails on the shell this accont is assigne! to the .bin.false shell or .bin.nologin. 5hese both
shells are same they both !o the same %or& of reKecting the ser login to the shell. 5he main !ifference bet%een
these t%o shells is that false shell sho%s the incorrect co!e an! any nsal co!ing %hen ser login %ith it. 8t the
nologin shell simply tells that no sch accont is available. 6o nologin shell is se! mostly in +in'.
Which !aemn is respnsib$e #r trac"ing events n )inux system'
syslog! is responsible for trac&ing system information an! save it to the !esire! log files. It provi!es t%o system
tilities %hich provi!e system logging an! &ernel message trapping. Internet an! G@IS !omain soc&ets spport
enable this tility pac&age to spport both local an! remote logging. )very logge! message contains at least a time
an! a hostname fiel!* normally a program name fiel!* too. 6o to trac& these information this !aemon is se!. syslog!
mainly reacts to the set of signals given by the ser. 5hese are the signals given to syslog!, 6IFHG>, 5his lets
syslog! perform a re=initialiDation. All open files are close!* the configration file ?!efalt is .etc.syslog.confA %ill be
rerea! an! the syslog facility is starte! again. 6IF5)R#, 5he syslog! %ill !ie. 6IFI@5* 6IF;GI5, If !ebgging is
enable! these are ignore!* other%ise syslog! %ill !ie. 6IFG6R1, 6%itch !ebgging on.off. 5his option can only be
se! if syslog! is starte! %ith the = ! !ebg option. 6IF$H+D, Wait for $hil!s if some %ere born* becase of %aiting
messages.
Which !aemn is use! #r sche!u$ing # the cmman!s'
5he crontab comman! is se! for sche!ling of the comman!s to rn at a later time. 6E@5AS
crontab X = ser Y file
crontab X = ser Y H =l Q =r Q =e I
/ptions
=l +ist = !isplay the crrent crontab entries.
=r Remove the crrent crontab.
=e )!it the crrent crontab sing the e!itor specifie! by the \I6GA+ or )DI5/R environment variables.
When ser e'its from the e!itor* the mo!ifie! crontab %ill be installe! atomatically. )ach ser can have their o%n
crontab* an! thogh these are files in .var* they are not inten!e! to be e!ite! !irectly. If the [ option is given than
the crontab gives the name of the ser %hose crontab is to be t%ea&e!. If it is given %ithot this then it %ill !isplay the
crontab of the ser %ho is e'ecting the comman!.
(w envirnment variab$e is set s that the #i$e permissin can be autmatica$$y set t the new$y
create! #i$es'
mas& comman! is se! to set file permission on ne%ly create! files atomatically.
6ynta'
mas& X=pY X=6Y Xmo!eY
It is represente! in octal nmbers. We can simply se this comman! %ithot argments to see the crrent file
permissions. 5o change the permissions* mo!e is given in the argments. 5he !efalt mas& se! for normal ser is
000". 5he !efalt mas& for the root ser is 00"". 0or calclating the original vales* the vales sho%n by the mas&
mst be sbtracte! by the !efalt vales. It is mainly se! for mas&ing of the file an! !irectory permission. 5he
.etc.profile script is %here the mas& comman! is sally set for all sers. 5he [6 option can be se! to see the
crrent !efalt permissions !isplaye! in the alpha symbolic format.
0or e'ample* mas& 0"" ensres that ne% files %ill have at most 355 permissions ?333 @A@D 0""A.
5he permissions can be calclate! by ta&ing the @A@D of original vale %ith the !efalt vales of files an!
!irectories.
1.When do you need a virtual hosting ?
The term Virtual Host refers to the practice of maintaining more than one server on one machine,
as differentiated ! their apparent hostname. "or e#ample, it is often desirale for companies
sharing a we server to have their own domains, with we servers accessile
as www.!ompany1.!om and www.!ompany2.!om, without re$uiring the user to %now an!
e#tra path information.
2.In which port telnet is listening?
&'
.!ow to get the listening ports which is greater than "### using netstat ?
$.!ow to %loc& and openrelay ?
(pen rela!s are e)mail servers that are configured to accept and transfer e)mail on ehalf of an!
user an!where, including unrelated third parties.
The $mail)smtpd daemon will consult the rcpthosts control file to determine valid destination
addresses, and re*ect an!thing else.
'.What is sandwitch con(iguration in q)ail ?
+mail , -lam , Spamassassin) This is normall! called Sandwitch configuration in $mail.
".*dvantages o( +)ail ?
More secure, etter designed, modular, faster, more reliale, easier to configure, don.t have to
upgrade it ever! few months or worr! aout eing vulnerale to something due to some oscure
feature eing enaled
$mail supports host and user mas$uerading, full host hiding, virtual domains, null clients, list)
owner rewriting, rela! control, doule)ounce recording, aritrar! /"- 0&& address lists, cross)
host mailing list loop detection, per)recipient chec%pointing, downed host ac%offs, independent
message retr! schedules, etc. $mail also includes a drop)in 11sendmail.. wrapper so that it will e
used transparentl! ! !our current 23s.
7.What is the difference between POP3 and IMAP ?
The 4ifference
POPG wor's by reviewing the inbo# on the mail server& and downloading the new messages
to your om$uter" IPAP downloads the headers o! the new messages on the server& then
retrieves the message you want to read when you li' on it"
,hen using POPG& your mail is stored on your PQ" ,hen using IPAP& the mail is stored on the
mail server" .nless you o$y a message to a *3oal 7older* the messages are never o$ied
to your PQ"
Senarios o! .se
POPG
<ou only he' e6mail !rom one om$uter"
<ou want to remove your e6mail !rom the mail server"
IPAP
<ou he' e6mail !rom multi$le loations"
<ou use ,ebmail"
,.!ow to drop pac&ets using ipta%les ?
5ptales )3 5672T )s ##.##.##.## )d ##.##.##.## )* 4/(7
-..aily routines o( Linux *d)inistrators ?
8.-hec% the health of servers
8.-hec% for updates
8.-hec% the 9ac%up
8.-hec% with the troule tic%eting s!stem for an! unread tic%et.
8.Trouleshoot if there an! prolem
8.5nstallation of new servers, if needed.
8./eport to the 9oss
1#.!ow to ta&e the .u)p o( a /y0+L .ata%ase ?
M!s$ldump dataasename : dumpname
11.!ow to &now the 123 usage o( each process ?
Top, uptime
12.!ow to %ind another I2 in a 4I1 ?
-op! the contents eth; to eth1, and change the ipaddress. /estart the networ%. .
1.5ransparently proxy all we%6sur(ing through 0quid %ox
i$tables 6t nat 6A P/2/O.TI?% 6i eth0 6t$ 66d$ort N1 6- 8?AT 66to
i$tables 6t nat 6A P/2/O.TI?% 6i eth0 6t$ 66d$ort N1 6- 8?AT 66to
14.Transparently redirect web connections fro o!tside to the "M# web ser$er.
i$tables 6t nat 6A P/2/O.TI?% 6i eth1 6d 0OE"0AN"0"0 6d$ort N1 6- 8?AT Rto
1% &owto Acti$ate the forwardin'
eho 0 S;$ro;sys;net;i$vB;i$T!orward
1(.)ill spoofed pac*ets
!or ! in ;$ro;sys;net;i$vB;on!;);r$T!ilter@ do
eho 0 S U!

You might also like