UNIX操作系统基础.docx
《UNIX操作系统基础.docx》由会员分享,可在线阅读,更多相关《UNIX操作系统基础.docx(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Linux操作系统基础教程提到Linux操作系统,就不能不提UNIX和GNU。UNIX是由AT&T Bell 实验室于1969年开发的多用户、多任务操作系统,是目前广泛使用的商业操作系统。而GNU则开始于1984年,Richard Stallman发起的 GNU计划,目的是为了创建一套完全自由的操作系统(GNU宣 言)。GNU是“GNUs Not Unix”的递归缩写。(通用公共许可 GNU General Public License,GPL,反版权copyleft, 自由软件基金会Free Software Foundation, FSF)。1991年,Linus Torvalds编写了与
2、UNIX兼容的LINUX操作系统并在GPL条款下发布。1992年, Linux与其他GNU软件结合,产生了完全自由的操作系统,所以Linux操作系统又被称为 “GNU/Linux”。三大主流shell查看文件/etc/shell,可列出操作系统所包含的shellBourne shell也称sh,是Version 7 Unix默认的Unix Shell。Bourne Again Shell 多数Linux操作系统的默认shell,是Bourne shell(UC Berleley)的扩展,是Bourne again/ Born again shell的双关语,1987年由Brian Fox创造。
3、C shell,TC shell模仿C的语法,开发与BSD系统,脱胎于第六版UNIX的/bin/sh,也是 Bourne shell的前身,加入了alias, command history等功能。Korn shell是第一个UNIX shell,它完全向上兼容Bourne shell并包含了许多C shell的特性。查看用户的默认shell,请查看文件/etc/passwd每个进程都有一个进程号pid,可用pstree或者ps ef命令查看1. 常用Linux命令(1) uname(2) ls(3) ps(4) date(5) who(6) pwd(7) mkdir(8) rmdir(9)
4、rm(10) touch(11) id(12) group(13) su(14) which(15) where2. C Shell1. shbang line#!/bin/csh 或者 #!/bin/tcsh2. comments# this is comment line3. wildcards4.5. local variablesset variable=value set tom=”tom”6. global variables setenv variable value setenv tom tom7. extract the variable value echo $variab
5、le_name echo $nameecho $PRINTER8. user inputecho “what is your name?” set name = $, =, , , =, , , =, , =14. conditional statements15. loops16. functions function_name() block of codefunction function_name block of code6. regular expression and pattern matching正则表达式与模式匹配1. regular expressiondefinitio
6、n: a regular expression is just a pattern of characters used to match the same characters in a search.Hi Tom,I think I failed my anatomy test yesterday. I had a terrible stomachache. I ate too many fried green tomatoes. Anyway, Tom, I need your help. Id like to make the test up tomorrow, but dont kn
7、ow where to begin studying. Do you think you could help me? After work, about 7 PM, come to my place and Ill treat you to pizza in return for your help. Thanks.Your Pal, guyphantomif we want to substitute “Tom” or “tom” in the text to “admin”, how?vi里面寻找包含”tom”的行:/tom/,如果只是简单的寻找,一方面无法找到Tom,另一方面还会找到s
8、tomachache、tommorrow以及tomatoes等。因此需要比较复杂的正则表达式的应用。:1,$s/admin/g即可完成替代 其中1,$表示从第一行到最后一行 s表示取代(substitute) Tt表示字母”T”或者”t”的其中一个 表示一个单词的结束,这里不一定是同一个单词 /g表示全局取代Beginning of line anchor/love/Matches all lines beginning with love$End of line anchor/love$/Matches all lines ending with love.Matches one chara
9、cter/l.e/Matches lines containing an l,Followed by two characters*Matches zero or more ofthe preceding/ *love/Matches lines with zero or more spaces,followed by the pattern love Matches one in the set/Llove/Matches line containing love or Lovex-yMatches one characterwithin range from x to y/A-Zove/M
10、atches letters from A through Zfollowed by ove Matches one characternot in the set/A-Z/Matches any character not in the rangebetween A and ZUsed to escape a meacharacter/love./Matches lines containing love, followedby a literal period; normally the period matches a single any characterBeginning of w
11、ord anchor/End-of-word anchor/love/Matches lines containing a word that2. metacharacter元字符ends with love (supported by vi andgrep)(.)Tags match characters to be used/(love)able1er/May use up to nine tags, starting with the first tag at the leftmost part of thepatternxm or xm, orxm,no5,10Matches if l
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- UNIX 操作系统 基础
限制150内