[color=olive]1.Q.Howdoyoulistfilesinadirectory?

A:ls

ls

语法:ls[选项]路径名称

-a显示所有档案及目录(ls内定将档案名或目录名称开头为"."的视为隐藏档,不会列出)

-l除档案名称外,亦将档案型态,权限,拥有者,档案大小等资讯详细列出

-r将档案以相反次序显示(原定依英文字母次序)

-t将档案依建立时间之先后次序列出

-A同-a,但不列出"."(目前目录)及".."(父目录)

-F在列出的档案名称后加一符号;例如可执行档则加"*",目录则加"/"

-R若目录下有档案,则以下之档案亦皆依序列出

2.Q.Howdoyoulistallfilesinadirectory,includingthehiddenfiles?

A:ls-a

3.Q.Howdoyoufindoutallprocessesthatarecurrentlyrunning?

A:ps-f

4.Q.Howdoyoufindouttheprocessesthatarecurrentlyrunningoraparticularuser?

A:ps-auusername

-A列出所有的行程

-w显示加宽可以显示较多的资讯

-au显示较详细的资讯

-aux显示所有包含其他使用者的行程

-U<用户识别码> 列出属于该用户的进程的状况,也可使用用户名称来指定。

U<用户名称> 列出属于该用户的进程的状况。

5.Q.Howdoyoukillaprocess?

A:killpid

6.Q.Whatwouldyouusetoviewcontentsofthefile?

A:lessfilename

catfilename

pgfilename

prfilename

morefilename

mostusefuliscommand:tailfile_name-youcanseetheendofthelogfile

7.Q.Whatwouldyouusetoeditcontentsofthefile?

A:vifile

8.Q.Whatwouldyouusetoviewcontentsofalargeerrorlogfile?

A:tail-10file_name(last10rows)

9.Q.HowdoyoulogintoaremoteUnixbox?

A:Usingtelnetserver_nameorssh-l(ssh-OpenSSHSSHclient(remoteloginprogram))

10.Q.HowdoyougethelponaUNIXterminal?

A:mancommand_name

infocommand_name(moreinformation)

11.Q.Howdoyoulistcontentsofadirectoryincludingallofitssubdirectories,providingfulldetailsandsortedbymodificationtime?

A:ls-lac

-aallentries

-cbytime

12.Q.Howdoyoucreateasymboliclinktoafile(givesomereasonsofdoingso)?

A:ln/../file1Link_name

Linkscreatepointerstotheactualfiles,withoutduplicatingthecontentsofthefiles.Thatis,alinkisawayofprovidinganothernametothesamefile.Therearetwotypesoflinkstoafile:Hardlink,Symbolic(orsoft)link;

13.Q.Whatisafilesystem?

A:Sumofalldirectoriescalledfilesystem.AfilesystemistheprimarymeansoffilestorageinUNIX.Filesystemsaremadeofinodesandsuperblocks.

14.Q.Howdoyougetitsusage(afilesystem)?

A:Bystoringandmanipulatefiles.

15.Q.Howdoyoucheckthesizesofallusers?homedirectories(onecommand)?

A:du-s

df

16.Q.Howdoyoucheckforprocessesstartedbyuser'pat'?

A:ps-fupat(-f-full_formatu-user_name)

17.Q.Howdoyoustartajobonbackground?

A:bg%4

18Q.Whatutilitywouldyouusetoreplaceastring'2001'for'2002'inatextfile?

A:grepkde

19.Q.Whatutilitywouldyouusetocutoffthefirstcolumninatextfile?

A:awkkde

20.Q.Howtocopyfileintodirectory?

A:cpdir

21.Q.Howtoremovedirectorywithfiles?

A:rm-rfdirectory_name

22.Q.Whatisthedifferencebetweeninternalandexternalcommands?

A:Internalcommandsarestoredinthesamelevelastheoperatingsystemwhileexternalcommandsarestoredontheharddiskamongtheotherutilityprograms.

23.Q.Listthethreemainpartsofanoperatingsystemcommand:

A:Thethreemainpartsarethecommand,optionsandarguments.

24Q.Whatisthedifferencebetweenanargumentandanoption(orswitch)?

A:Anargumentiswhatthecommandshouldacton:itcouldbeafilename,directoryorname.Anoptionisspecifiedwhenyouwanttorequestadditionalinformationoverandabovethebasicinformationeachcommandsupplies.

25.Q.Whatisthepurposeofonlinehelp?

A:Onlinehelpprovidesinformationoneachoperatingsystemcommand,thesyntax,theoptions,theargumentswithdescriptiveinformation.

26.Q.Nametwoformsofsecurity.

A.TwoformsofsecurityarePasswordsandFileSecuritywithpermissionsspecified.

27.Q.Whatcommanddoyoutypetofindhelpaboutthecommandwho?

A.$manwho

28.Q.Whatisthedifferencebetweenhomedirectoryandworkingdirectory?

A.Homedirectoryisthedirectoryyoubeginatwhenyoulogintothesystem.Workingdirectorycanbeanywhereonthesystemanditiswhereyouarecurrentlyworking.

29.Q.Whichdirectoryisclosertothetopofthefilesystemtree,parentdirectoryorcurrentdirectory?

A.Theparentdirectoryisabovethecurrentdirectory,soitisclosertotherootortopofthefilesystem.

30.Q.Giventhefollowingpathname:

$/business/acctg/payable/supplier/april

a)Ifyouwereinthedirectorycalledacctg,whatwouldbetherelativepathnamenameforthefilecalledapril?

b)Whatwouldbetheabsolutepathnameforapril?

A:

a)$payable/supplier/april

b)$/business/acctg/payable/supplier/april

31.Q.Supposeyourdirectoryhadthefollowingfiles:

help.1help.2help.3help.4help.O1help.O2

aid.O1aid.O2aid.O3back.1back.2back.3

a)Whatisthecommandtolistallfilesendingin2?

b)Whatisthecommandtolistallfilesstartinginaid?

c)Whatisthecommandtolistall"help"fileswithonecharacterextension?

A:

a)ls*2

b)lsaid.*

c)lshelp.?

32.Q.Whataretwosubtledifferencesinusingthemoreandthepgcommands?

A.Withthemorecommandyoudisplayanotherscreenfulbypressingthespacebar,withpgyoupressthereturnkey.

ThemorecommandreturnsyouautomaticallytotheUNIXshellwhencompleted,whilepgwaitsuntilyoupressreturn.

33.Q.Whenisitbettertousethemorecommandratherthancatcommand?

A.Itissometimesbettertousethemorecommandwhenyouareviewingafilethatwilldisplayoveronescreen.

34.Q.Whataretwofunctionsthemovemvcommandcancarryout?

A.Themvcommandmovesfilesandcanalsobeusedtorenameafileordirectory.

35.Q.Nametwomethodsyoucouldusetorenameafile.

A:Twomethodsthatcouldbeused:

a.usethemvcommand

b.copythefileandgiveitanewnameandthenremovetheoriginalfileifnolongerneeded.

36.Thesoccerleagueconsistsofboyandgirlteams.Theboyfilenamesbegin

withB,thegirlteamsbeginwithG.Allofthesefilesareinonedirectory

called"soccer",whichisyourcurrentdirectory:

Bteam.abcBteam.OOlBteam.OO2Bteam.OO4

Gteam.winGteam.OOlGteam.OO2Gteam.OO3

Writethecommandstodothefollowing:

a)renamethefileBteam.abctoBteam.OO3.

b)erasethefileGteam.winafteryouhaveviewedthecontentsofthefile

c)makeadirectoryfortheboyteamfilescalled"boys",andoneforthegirlteamfiles

called"girls"

d)movealltheboyteamsintothe"boys"directory

e)moveallthegirlteamsintothe"girls"directory

f)makeanewfilecalledGteam.OO4thatisidenticaltoGteam.OOl

g)makeanewfilecalledGteam.OO5thatisidenticaltoBteam.OO2

A.

a)mvBteam.abcBteam.OO3.

b)catGteam.win-or-moreGteam.win

rmGteam.win

c)mkdirboys

mkdirgirls

d)mvBteam*boys

e)mvGteam*girls

f)cdgirls

cpGteam.OO1Gteam.OO4

g)Thereareseveralwaystodothis.Rememberthatwearecurrentlyinthedirectory

/soccer/girls.

cp../boys/Bteam.OO2Gteam.OO5

or

cd../boys

cpBteam.OO2../girls/Gteam.OO5

37.Q.Whatmetacharacterisusedtodothefollowing:

1.1Moveuponelevelhigherinthedirectorytreestructure

1.2Specifyallthefilesendingin.txt

1.3Specifyonecharacter

1.4Redirectinputfromafile

1.5Redirecttheoutputandappendittoafile

A.

1.1.1double-dotor..

1.2asteriskor*

1.3questionor?

1.4doublegreaterthansign:>>

1.5thelessthansignor<

38.Q.Whichofthequotingorescapecharactersallowsthedollarsign($)toretainitsspecialmeaning?

A.Thedoublequote(")allowsthedollarsign($)toretainitsspecialmeaning.

Boththebackslash(\)andsinglequote(')wouldremovethespecialmeaningofthedollarsign.

39.Q.Whatisafasterwaytodothesamecommand?

mvfileO.txtnewdir

mvfilel.txtnewdir

mvfile2.txtnewdir

mvfile3.txtnewdir

A.Ashortcutmethodwouldbe:mvfile?.txtnewdir

40.Q.Listtwowaystocreateanewfile:

A.

a.Copyafiletomakeanewfile.

b.Usetheoutputoperatore.g.ls-l>newfile.txt

41.Q.Whatisthedifferencebetween>and>>operators?

A.Theoperator>eitheroverwritestheexistingfile(WITHOUTWARNING)orcreatesanewfile.

Theoperator>>eitheraddsthenewcontentstotheendofanexistingfileorcreatesanewfile.

44.Writethecommandtodothefollowing:

44.1Redirecttheoutputfromthedirectorylistingtoaprinter.

44.2Addthefileefg.txttotheendofthefileabc.txt.

44.3Thefiletestdatafeedsinformationintothefilecalledprogram

44.4Observethecontentsofthefilecalledxyz.txtusingMORE.

44.5Observeadirectorylistingthatisfourscreenslong.

A.

44.1ls>lpr

44.2catefg.txt>>abc.txt

44.3program<testdata

44.4more<xyz.txt

44.5ls>dirsave|more

46.Q.Howcanyouseeallmounteddrives?

A.mount-l

47.Q.Howcanyoufindapathtothefileinthesystem?

A.locatefile_name(locate-listfilesindatabasesthatmatchapattern)

48.Q.WhatLinuxHotKeysdoyouknow?

A.Ctrl-Alt-F1Exittocommandprompt

Ctrl-Alt-F7orF8TakesyoubacktoKDEdesktopfromcommandprompt

Crtl-Alt-BackspaceRestartXWindows

Ctrl-Alt-DShowdesktop

49.Q.WhatcanyoutellaboutthetarCommand?

A.Thetarprogramisanimmenselyusefularchivingutility.Itcancombineanentiredirectorytreeintoonelargefilesuitablefortransferringorcompression.

50.Q.Whattypesoffilesyouknow?

A.Filescomeineightflavors:

Normalfiles

Directories

Hardlinks

Symboliclinks

Sockets

Namedpipes

Characterdevices

Blockdevices

51.Q.HowtocopyfilesfromonPCtoanotheronthesamenetwork

A.Usethefollowingcommand:scpyur_fileyou_login@your_IP

example:copy.conffilefromyourPCtoalexcomputer-

scp/etc/X11/[email protected]:

53.Q.Ifyouwouldliketoruntwocommandsinsequencewhatoperatorsyoucanuse?

A.;or&&thedifferenceis:

ifyouseparatecommandswith;secondcommandwillberunautomatically.

ifyouseparatecommandswith&&secondcommandwillberunonlyinthecasethefirstwasrunsuccessfully.

54.Q.Howyouwilluncompressthefile?

A.Usetarcommand(TheGNUversionofthetararchivingutility):

tar-zxvffile_name.tar.gz

55.Q.Howdoyouexecuteaprogramorscript,my_scriptinyourcurrentdirectoty?

A../my_script

56.Q.Howtofindcurrenttimeconfigurationinthefilemy_new.cfg

A.greptimemy_new.cfg

Grepsearchesthenamedinputfiles(orstandardinputifnofilesarenamed,orthefilename-isgiven)forlinescontainingamatchtothegivenpattern.

59.Q.Howtofinddifferenceintwoconfigurationfilesonthesameserver?

A.Usediffcommandthatiscomparefileslinebyline

diff-u/usr/home/my_project1/etc/ABC.conf/usr/home/my_project2/etc/ABC.conf

61.Q.Pleasewritealoopforremovingallfilesinthecurrentdirectorythatcontainsaword'log'

A.foriin*log*;dorm$i;done

62.Question:Howtoswitchtoapreviouslyuseddirectory?

Answer:cd-[/color]