下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
软件工程师培训系列教材
UNIX
,翻印必究
SoftwareDevelopmentinUnixEnvironment《UNIX操作系统(第五版)》
JerryPeek,GraceTodino&John Strang著龚志翔等译
2003年1月出版
书号:7-111-10164-2
页数:188
定价:26.00元ReferenceBook登录和登出Solaris系统操作Solaris文件系统新建文件,目录,并改变它们的权限生成文本文件,并使用vi文本编辑器使用命令查找系统中的文件和目录使用ftp命令进行文件传输定义和修改系统初始化文件课程目标训练环境:SUNUltra10WorkstationwithSolarisOperatingSystem预期课时:1day训练环境Ch1操作系统概述及Solaris介绍HardWareOperationSystemApplicationUserApplicationdeveloperSystemdeveloperOthersMacUnixLinuxWindowsSUN,IBM,HP,SGI,FreeBSD,DEC,SCORedHat,SuSE,SlackWare,红旗
NT,98,2000,XPUNIX和其他操作系统比较TheSolarisistheSun™versionoftheUNIXsystem1965BellLaboratoriesjoinswithMITandGEinthedevelopmenteffortforthenewoperatingsystem,Multics1970,Jan1timezeroforUNIX.ItisnamedbyBellLabsprogrammers,BrianKernighanandDennisRitche1973Unixisre-writtenmostlyinC1980BSD4.1(BerkeleySoftwareDistribution).BerkeleyaddedVMsupport,TCP/IPnetworking,vi,csh,andmore1983SunOSwasbasedonBSDUNIXVersion4.21988AT&TandSunMicrosystemsjointlydevelopSystemVRelease4(SVR4).ThiswouldlaterbedevelopedintoSolaris2Solaris介绍ReleasesunOSSolarisHP-UXAIXWindowsRedhatLinuxDateversionversionversionversionversionversionHalloweenUnix版本的发展历史Whatcanitdo?Server:Webserver,Mailserver,DatabaseServer,…ProgramDevelopmentWhoshouldknowUnix?Unixadministrator,OracleAdministrator,NetworkEngineerProgramDeveloperMoreaboutUnixInputdevicesOutputdevicesRAMCPUI/OHarddiskHardware操作系统vs.应用软件客户端软件vs.服务器端软件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.文件系统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设置密码的要求ChangingpasswordsfrequentlyhelpsavoidunauthorizedaccessTypethepasswdcommandTypeyourcurrentpasswordandpressReturnTypeyournewpasswordandpressReturnRetypethenewpasswordandpressReturn改变密码/etc/passwd root:x:0:1:SuperUser:/:/bin/sh/etc/shadow root:daGaerRdafGEg::::Usernamevs.UIDUser’shomedirectory用户帐号Ch3基本Unix命令清除终端屏幕的内容clearclear显示当前工作目录的绝对路径(printworkingdirectory)pwdpwd改变工作目录可以用绝对路径或相对路径的形式给出目录位置当前目录 .
上层目录 .. 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 文拥同其链拥拥大最后一次文 件有组它接有有小修改时间件 类者人人号者组名 型权权权 限限限lsddirectory -normalfilefilefilename(s)Text,includingASCIItext,Englishtext,commandstextandexecutablescriptsExecutableorBinary,including32-bitexecutableandextensiblelinkingformat(ELF)codefilesandotherdynamicallylinkedexecutablesData,thosecreatedbyanapplicationrunningonthesystemls–F Displayingfiletypes 目录文件 / 可执行文件 * 文本文件 (none)FileTyper -读权限w -写权限,对目录来说,可生成文件与子目录或删除文件与子目录x -执行权限,对目录来说,可查找该目录下内容- -没有权限
如-
rw-
r--
r— 拥同其 有组它 者人人其中拥有者-生成文件时登录的人,权限最高,u表示同组人-系统管理员分配的同组的一个或几个人,g表示其它人-除拥有者,同组人外的人,o表示
所有人-包括拥有者、同组人及其它人,a表示FilePermission改变权限以字母和符号组合的方式设定权限
chmodg-rfile1
chmodu+x,go+rfile1
chmoda=rwfile1chmod修改文件访问权限chmodmodefilenamewhocppermission(s)rReadwWritexExecute=Setpermissions-Removeaccess+GiveaccessuUserorownerofthefilegGrouptowhichthefilebelongsoOthersoutsideownerandgroupaAlloftheabove用八进制数字的形式给出权限 chmod555dante chmod644dante chmod755danteOctalValuePermissions4Read2Write1ExecuteOctalValuePermissions7rwx6rw-5r-x4r--3-wx2-w-1--x0---建立一个新的空文件,或者更新文件的访问和修改时间 touchfilename(s)touch使用绝对路径或者相对路径来建立目录建立目录时应该有相应的权限 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帮助手册描述了系统命令,系统调用,文件格式以及系统维护等方面的信息。mannameman–kkeywordScrollinginManpages Spacebar ScrollthroughamanualpageonescreenatatimeReturn Scrollthroughamanualpageonelineatatimeb Movebackonescreenf Moveforwardonescreenq Quitthemancommand/string Searchforwardforinformationn Findthenextoccurrenceofstringman -manisyourfriend显示用户名和用户ID id[option(s)] id idroot id–arootid显示已登录用户列表 usersusers显示登录到本地机器上的用户的详细信息 who wwhoami命令显示当前用户的登录信息 whoamiwhoami命令仅显示当前用户的登录名 whoamiFindingPeople
根据给定的条件查找文件,然后对找到的文件执行某些操作 findpathexpression[action]查找条件:-name:按文件名查找-user:按文件的拥有者查找-perm:按文件的访问权限查找-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统计文件中的行数,单词数以及字符数。 wc[options]filename(s)-l统计行数-w统计单词数-C统计字符数
grepwang/etc/passwd|wc-lwctelnetThetelnetserversimulatesaterminaltoallowyoutoconnecttoandworkonaremotesystemusesTCP/IPtoconnecttoanothersystem telnethostname[port]rloginEstablisharemoteloginsessiononanotherworkstation rloginhostnametelnetandrloginServerswithsitessetupfordownloadingfilessometimesprovideananonymousftpaccount ftp3 Name:(username) Password:(user’spassword)Commands:cd,lcd改变远程机器目录改变本地机器的目录dir列出remotehost上的档案
bye离开ftpbin,asc将传输模式设为binary模式将传输模式设为ascii模式get,put,mget,mput下载/上传档案hashprompt更改交谈模式,若为on则在mput与mget时每作一个档案之传输时均会询问ftp对shell有特殊含义的一些字符例如:;$%>!~*?[]<>|ExceptThedot(.)andunderscore(_)Ch4
Metacharacters代表零和多个字符 lsd*Asterisk(*)代表任意的一个字符
lsd? lsz?.txtQuestionMark(?)匹配一个集合或一段范围内的字符代表一个字符
ls[b-f]b* ls[fF]f*a?cSquareBrackets([])在一个命令行输入多个命令
cd;ls date;cal;pwdSemicolon(;)使用(>)将命令的输出结果重定向到文件而不是终端屏幕。使用(<)将命令的输入重定向到文件而不是终端键盘。使用(>>)将命令的结果添加到已经存在的文件末尾,而不覆盖原文件。 cal102004>a.txt cal112004>>a.txt
cat<f1.txt>f2.txtAngleBrackets(>,<,>>)将某个文件的输出作为另外一个文件的输入
cal72003|lp ls-l/etc|morePiping(|)Configurationfiles,webpages,programsourcecodearealltext-basedTextviewersv.s.editorsCh5文本编辑将文件内容显示在终端屏幕上。经常用来将两个或多个文件连接成一个大文件。 catfilename(s)
cat/dev/null>~/b.txt cat/etc/passwdcat以分屏的方式显示文件的内容。 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 在光标当前位置插入
a 在光标所在位置后插入 o 在光标所在行下插入一空行 <Esc> 退出插入状态Input x 删除一个字符 dw 删除当前词 3dw 删除三个词 dd 删除当前行 5dd 删除五行 :5,10dDeletingText
r 替换一个字符
cw 替换一个单词
cc 替换一行
C 替换从光标至行尾ChangingTextyw
拷贝词yy
拷贝行(或Y)p 当前行下粘贴:1,2co3 拷贝行1,行2在行3之后:4,5m6 移动行4,行5在行6之后CopyingandPastingText:w 存盘:wnewfile
存成新文件:wq 存盘退出Vi(或ZZ,或:x):q! 强行退出不存盘SavingandQuittingFiles~ 改变大小写//notuseJ 把当前行和下一行连起来u 废除刚才的编辑操作(undo):setnu 显示行代码(:setnonu):21 光标停在指定行21G 光标停在指定行(G到文件尾,1G到文件头)/串 从当前行往下查找?串 从当前行往上查找n 查找继续:rfile2 在光标所在位置插入另一个文件:1,$s/旧串/新串/g 替换全文(或:%s/旧串/新串/g)AdvancedEditingOptionsCh6SetupInitializationFilesSunOS5.x系统提供一些默认的环境变量,其值是可以配置的。在命令行临时改变环境变量的值只能影响当前的shell。永久改变环境变量的值需要修改初始化文件
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025版贫血症状识别与营养护理指导
- 幼儿园科普教育
- 医院感染风险评估案例
- 腹膜透析患者营养管理
- 线上考级方法分享
- 小儿消化不良护理科普
- 声音管理员工自我介绍
- 钉钉功能介绍及使用方法
- 长期打针血管护理方法
- 脑瘤常见症状解析及护理要点
- 医院岗前培训医保课件
- 2025-2030中国半导体工艺过滤器市场发展现状及前景趋势洞察报告
- 教学中医课件模板
- 俄罗斯饮食文化课件
- 2025年食品安全与卫生管理综合能力考试试卷及答案
- CJ/T 358-2019非开挖工程用聚乙烯管
- 《黑色三分钟 生死一瞬间》一部-八部事故分类统计
- 全口义齿的设计和制作
- 纹眉术前协议书
- 2025年4月自考02204经济管理试题及答案
- 语音厅主播合同协议
评论
0/150
提交评论