老板課件-達內(nèi)預(yù)科unix_第1頁
老板課件-達內(nèi)預(yù)科unix_第2頁
老板課件-達內(nèi)預(yù)科unix_第3頁
老板課件-達內(nèi)預(yù)科unix_第4頁
老板課件-達內(nèi)預(yù)科unix_第5頁
免費預(yù)覽已結(jié)束,剩余75頁可下載查看

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

軟件工程師培訓(xùn)系列教材

UNIX

,翻印必究

SoftwareDevelopmentinUnixEnvironment《UNIX操作系統(tǒng)(第五版)》

JerryPeek,GraceTodino&John Strang著龔志翔等譯

2003年1月出版

書號:7-111-10164-2

頁數(shù):188

定價:26.00元ReferenceBook登錄和登出Solaris系統(tǒng)操作Solaris文件系統(tǒng)新建文件,目錄,并改變它們的權(quán)限生成文本文件,并使用vi文本編輯器使用命令查找系統(tǒng)中的文件和目錄使用ftp命令進行文件傳輸定義和修改系統(tǒng)初始化文件課程目標訓(xùn)練環(huán)境:SUNUltra10WorkstationwithSolarisOperatingSystem預(yù)期課時:1day訓(xùn)練環(huán)境Ch1操作系統(tǒng)概述及Solaris介紹HardWareOperationSystemApplicationUserApplicationdeveloperSystemdeveloperOthersMacUnixLinuxWindowsSUN,IBM,HP,SGI,FreeBSD,DEC,SCORedHat,SuSE,SlackWare,紅旗

NT,98,2000,XPUNIX和其他操作系統(tǒng)比較TheSolarisistheSun?versionoftheUNIXsystem1965BellLaboratoriesjoinswithMITandGEinthedevelopmenteffortforthenewoperatingsystem,Multics1970,Jan1timezeroforUNIX.ItisnamedbyBellLabsprogrammers,BrianKernighanandDennisRitche1973Unixisre-writtenmostlyinC1980BSD4.1(BerkeleySoftwareDistribution).BerkeleyaddedVMsupport,TCP/IPnetworking,vi,csh,andmore1983SunOSwasbasedonBSDUNIXVersion4.21988AT&TandSunMicrosystemsjointlydevelopSystemVRelease4(SVR4).ThiswouldlaterbedevelopedintoSolaris2Solaris介紹ReleasesunOSSolarisHP-UXAIXWindowsRedhatLinuxDateversionversionversionversionversionversionHalloweenUnix版本的發(fā)展歷史Whatcanitdo?Server:Webserver,Mailserver,DatabaseServer,…ProgramDevelopmentWhoshouldknowUnix?Unixadministrator,OracleAdministrator,NetworkEngineerProgramDeveloperMoreaboutUnixInputdevicesOutputdevicesRAMCPUI/OHarddiskHardware操作系統(tǒng)vs.應(yīng)用軟件客戶端軟件vs.服務(wù)器端軟件SoftwareSolarisOSKernelShellFileSystemHardwareKernelShellCPUManagesdevices,memory,andprocessesControlsthefunctionsbetweenthesystemprograms/utilitiesandthesystemhardwareManagesswapspace,daemons,filesystems,andotherfunctionsKernelAshellisaninterfacebetweentheuserandthekernel,whichactsasaninterpreterortranslatorThreeshellsareavailableintheSolarisenvironment:Bourneshell(sh)Kornshell(ksh)Cshell(csh)Bourne-againshell(bash)ShellWrittenbyStephenBourneforAT&TUnixTheearliestandbest-knownUnixshellCommondenominatorofmostshellscriptingBourne-AgainShell(bash)#root$userBourneShell(sh)CreatedaspartofBSDUnixbyBillJoy,theauthorofvi,attheUniversityofCaliforniaatBerkeleyIntroducedcommand-linehistoryandaprogrammingenvironmentsimilartotheCprogramminglanguageNotcompatiblewithBourneshellsyntaxtcsh,anenhancedbuttotallycompatiblecsh#root%userCShell(csh)Ahierarchyofdirectories,subdirectories,andfilesgroupedtogetherforaspecificpurpose.Directory–Alocationforotherfilesanddirectories.Thedirectorystructureenablesyoutocreatefilesanddirectoriesaccessedthroughahierarchyofdirectories.Subdirectory–Anydirectorybelowanotherdirectory.Forexample,someofthesubdirectoriesunderthe/directoryare/usr,/etc,and/kernel.文件系統(tǒng)The/(root)filesystemOn/dev/dsk/c0t0d0s0/optetcdevusrkernelvarexportdefaultdskadmhomebinsharelibOn/dev/dsk/c0t0d0s6The/usrfilesystemApplication1Application2user1user2user3On/dev/dsk/c0t0d0s5The/optfilesystemThe/export/homefilesystemOn/dev/dsk/c0t0d0s7ApathnameuniquelyidentifiesaparticularfileordirectorybyspecifyingitslocationAslash(/)betweeneachdirectorynameinthepathtoindicatedifferentdirectoriesAslashinthefirstpositionrepresentsthe/directoryAbsolutePathnameSpecifiesafileordirectoryinrelationtothe/directoryBeginwithaslashRelativePathnameSpecifiesafileinrelationtothecurrentworkingdirectoryDonotbeginwithaslash路徑名$Command[option(s)][argument[s]]AspacemustbeusedasadelimiterbetweeneachpartofthecommandlineUpto256characterscanbeenteredonasinglecommandlineDifferentfromDOS

CasesensitiveDifferentcommandprompt:/命令格式Ch2登錄和登出Logintelnet3 login:(username) password:(user’spassword)LogoutexitorlogoutMustbesixtoeightcharactersinlengthShouldcontainatleasttwoalphabeticcharactersandonenumericorspecialcharacterMustdifferfromtheloginIDMustdifferfromthepreviouspasswordbyatleastthreecharacters設(shè)置密碼的要求ChangingpasswordsfrequentlyhelpsavoidunauthorizedaccessTypethepasswdcommandTypeyourcurrentpasswordandpressReturnTypeyournewpasswordandpressReturnRetypethenewpasswordandpressReturn改變密碼/etc/passwd root:x:0:1:SuperUser:/:/bin/sh/etc/shadow root:daGaerRdafGEg::::Usernamevs.UIDUser’shomedirectory用戶帳號Ch3基本Unix命令清除終端屏幕的內(nèi)容clearclear顯示當(dāng)前工作目錄的絕對路徑(printworkingdirectory)pwdpwd改變工作目錄可以用絕對路徑或相對路徑的形式給出目錄位置當(dāng)前目錄 .

上層目錄 .. cd[directory_name]

cd/export/home/jerry cdjerry/dir1 cd cd../..cd顯示文件和子目錄列表ls–a Displayinghiddenfiles

Hiddenfile:afilestartedwitha“.”ls–R Displayingarecursivelistingls–t Sortsbytimestampinsteadofbynamels–l Displayingalonglist

d

rwx

r-x

r-x4usernobody1024Feb2209:20a.txt 文擁同其鏈擁擁大最后一次文 件有組它接有有小修改時間件 類者人人號者組名 型權(quán)權(quán)權(quán) 限限限lsddirectory -normalfilefilefilename(s)Text,includingASCIItext,Englishtext,commandstextandexecutablescriptsExecutableorBinary,including32-bitexecutableandextensiblelinkingformat(ELF)codefilesandotherdynamicallylinkedexecutablesData,thosecreatedbyanapplicationrunningonthesystemls–F Displayingfiletypes 目錄文件 / 可執(zhí)行文件 * 文本文件 (none)FileTyper -讀權(quán)限w -寫權(quán)限,對目錄來說,可生成文件與子目錄或刪除文件與子目錄x -執(zhí)行權(quán)限,對目錄來說,可查找該目錄下內(nèi)容- -沒有權(quán)限

如-

rw-

r--

r— 擁同其 有組它 者人人其中擁有者-生成文件時登錄的人,權(quán)限最高,u表示同組人-系統(tǒng)管理員分配的同組的一個或幾個人,g表示其它人-除擁有者,同組人外的人,o表示

所有人-包括擁有者、同組人及其它人,a表示FilePermission改變權(quán)限以字母和符號組合的方式設(shè)定權(quán)限

chmodg-rfile1

chmodu+x,go+rfile1

chmoda=rwfile1chmod修改文件訪問權(quán)限chmodmodefilenamewhocppermission(s)rReadwWritexExecute=Setpermissions-Removeaccess+GiveaccessuUserorownerofthefilegGrouptowhichthefilebelongsoOthersoutsideownerandgroupaAlloftheabove用八進制數(shù)字的形式給出權(quán)限 chmod555dante chmod644dante chmod755danteOctalValuePermissions4Read2Write1ExecuteOctalValuePermissions7rwx6rw-5r-x4r--3-wx2-w-1--x0---建立一個新的空文件,或者更新文件的訪問和修改時間 touchfilename(s)touch使用絕對路徑或者相對路徑來建立目錄建立目錄時應(yīng)該有相應(yīng)的權(quán)限 mkdir[-p]directory_name mkdirdir1/dir2 mkdirdir3dir4dir5 mkdir~/games mkdir-pdir6/dir7/dir8mkdir拷貝文件或目錄 cp[-i]source_filedestination_file cp[-i]source_file(s)destination_directory

cpbeansapple cpbeansappledir2 cp–ibeansappleCopyadirectoryanditscontentstoanotherdirectory cp-r[i]source_directory(s)destination_directory cp-rdir3dir4 cp-rdir3dir4/tmpcp移動或重命名文件和目錄 mv[-i]sourcetarget_file mv[-i]sourcetarget_directory

mvnutsbeans mv/export/home/jerry/brands~ mvdir5dir6mv刪除文件 rm[-i]filename(s) rmfile1file2file3 rm-ifile4刪除目錄 rmdirdirectory_name(s) rm-r[i]directory_name(s)

rmdirempty_dir

rm–rdir6 rm–ir~/dir7rm&rmdirUNIX幫助手冊描述了系統(tǒng)命令,系統(tǒng)調(diào)用,文件格式以及系統(tǒng)維護等方面的信息。mannameman–kkeywordScrollinginManpages Spacebar ScrollthroughamanualpageonescreenatatimeReturn Scrollthroughamanualpageonelineatatimeb Movebackonescreenf Moveforwardonescreenq Quitthemancommand/string Searchforwardforinformationn Findthenextoccurrenceofstringman -manisyourfriend顯示用戶名和用戶ID id[option(s)] id idroot id–arootid顯示已登錄用戶列表 usersusers顯示登錄到本地機器上的用戶的詳細信息 who wwhoami命令顯示當(dāng)前用戶的登錄信息 whoamiwhoami命令僅顯示當(dāng)前用戶的登錄名 whoamiFindingPeople

根據(jù)給定的條件查找文件,然后對找到的文件執(zhí)行某些操作 findpathexpression[action]查找條件:-name:按文件名查找-user:按文件的擁有者查找-perm:按文件的訪問權(quán)限查找-size:按文件大小來查找-type:按文件的類型查找-mtime:按文件的修改時間查找-atime:按文件的訪問時間查找

find/-nameperl

find.-mtime10–print

find/etc-user0–size+400–print

find~-perm777>~/holes

find/export/home-typef-atime+365-execrm{}\;find在文件中查找包含指定字符串的行,并把這些行輸出出來。casesensitive grep[option(s)]stringfilename-i忽略字符串的大小寫-v查找不包含指定字符串的行

greproot/etc/passwd ls-la|grep-i’sep1’grep統(tǒng)計文件中的行數(shù),單詞數(shù)以及字符數(shù)。 wc[options]filename(s)-l統(tǒng)計行數(shù)-w統(tǒng)計單詞數(shù)-C統(tǒng)計字符數(shù)

grepwang/etc/passwd|wc-lwctelnetThetelnetserversimulatesaterminaltoallowyoutoconnecttoandworkonaremotesystemusesTCP/IPtoconnecttoanothersystem telnethostname[port]rloginEstablisharemoteloginsessiononanotherworkstation rloginhostnametelnetandrloginServerswithsitessetupfordownloadingfilessometimesprovideananonymousftpaccount ftp3 Name:(username) Password:(user’spassword)Commands:cd,lcd改變遠程機器目錄改變本地機器的目錄dir列出remotehost上的檔案

bye離開ftpbin,asc將傳輸模式設(shè)為binary模式將傳輸模式設(shè)為ascii模式get,put,mget,mput下載/上傳檔案hashprompt更改交談模式,若為on則在mput與mget時每作一個檔案之傳輸時均會詢問ftp對shell有特殊含義的一些字符例如:;$%>!~*?[]<>|ExceptThedot(.)andunderscore(_)Ch4

Metacharacters代表零和多個字符 lsd*Asterisk(*)代表任意的一個字符

lsd? lsz?.txtQuestionMark(?)匹配一個集合或一段范圍內(nèi)的字符代表一個字符

ls[b-f]b* ls[fF]f*a?cSquareBrackets([])在一個命令行輸入多個命令

cd;ls date;cal;pwdSemicolon(;)使用(>)將命令的輸出結(jié)果重定向到文件而不是終端屏幕。使用(<)將命令的輸入重定向到文件而不是終端鍵盤。使用(>>)將命令的結(jié)果添加到已經(jīng)存在的文件末尾,而不覆蓋原文件。 cal102004>a.txt cal112004>>a.txt

cat<f1.txt>f2.txtAngleBrackets(>,<,>>)將某個文件的輸出作為另外一個文件的輸入

cal72003|lp ls-l/etc|morePiping(|)Configurationfiles,webpages,programsourcecodearealltext-basedTextviewersv.s.editorsCh5文本編輯將文件內(nèi)容顯示在終端屏幕上。經(jīng)常用來將兩個或多個文件連接成一個大文件。 catfilename(s)

cat/dev/null>~/b.txt cat/etc/passwdcat以分屏的方式顯示文件的內(nèi)容。 morefilename(s)

Spacebar ScrolltothenextscreenReturn Scrollonelineatatimeb Movebackonescreenf Moveforwardonescreenh DisplayaHelpmenuofmorefeaturesq Quitandreturntotheshellprompt/string Searchforwardforstringn Findnextoccurrenceofstringmore顯示文件的前n行或尾n行。默認顯示文件的前10行或尾10行。 head[-n]filename(s) tail[-n]filename(s)

tail-30/usr/dict/wordshead&tailCommandmodeLast-linemodeEntrymodeEscapeReturn:/?iaovi–FullScreenTextEditor vifilename Openorcreateafile vi OpenanewfiletobenamedlaterInvokingvi

向上

k

向下

j

向左

h

向右

lPositioning i 在光標當(dāng)前位置插入

a 在光標所在位置后插入 o 在光標所在行下插入一空行 <Esc> 退出插入狀態(tài)Input x 刪除一個字符 dw 刪除當(dāng)前詞 3dw 刪除三個詞 dd 刪除當(dāng)前行 5dd 刪除五行 :5,10dDeletingText

r 替換一個字符

cw 替換一個單詞

cc 替換一行

C 替換從光標至行尾ChangingTextyw

拷貝詞yy

拷貝行(或Y)p 當(dāng)前行下粘貼:1,2co3 拷貝行1,行2在行3之后:4,5m6 移動行4,行5在行6之后CopyingandPastingText:w 存盤:wnewfile

存成新文件:wq 存盤退出Vi(或ZZ,或:x):q! 強行退出不存盤SavingandQuittingFiles~ 改變大小寫//notuseJ 把當(dāng)前行和下一行連起來u 廢除剛才的編輯操作(undo):setnu 顯示行代碼(:setnonu):21 光標停在指定行21G 光標停在指定行(G到文件尾,1G到文件頭)/串 從當(dāng)前行往下查找?串 從當(dāng)前行往上查找n 查找繼續(xù):rfile2 在光標所在位置插入另一個文件:1,$s/舊串/新串/g 替換全文(或:%s/舊串/新串/g)AdvancedEditingOptionsCh6SetupInitializationFilesSunOS5.x系統(tǒng)提供一些默認的環(huán)境變量,其值是可以配置的。在命令行臨時改變環(huán)境變量的值只能影響當(dāng)前的shell。永久改變環(huán)境變量的值需要修改初始化文件

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論