Linux系统实验_第1页
Linux系统实验_第2页
免费预览已结束,剩余11页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、实验一Linux 基本命令练习请完成如下步骤并将每一步的情况截图及给出说明。1 请在自己的主文件夹下建立temp 目录并在该目录下建立mytest 目录。mkdir tempmkdir temp/mytestX xiao( (xiao-virtual-machine:-xiaogxtao-virtual-machine:mkdir tenp xtaoxiao-virtual-ma匚mkdir tenp/mytestxiaoxiao-virtual-machine:$ |2 进入 mytest 目录cd temp/mytestxiaoxiao-virtual-machine:-? mkdir t

2、empxiaoxiao-virtual-riachine:-$ mkdirtemp/mytest xidoxiao-virtual-machine:cdtemp/mytest xtaogxiao-virtual -nachine: /temp/rnytest$ |3 将给出的 man.config 复制到本目录下面,使用vi 打开本目录下的man.config 文件cp 桌面 /man.config temp/mytestxiaogxiao-virtual-machine:/temp/nytest$ cdxiaoxiao-virtual-machine:cp桌面/PI已n. cronfig t

3、emp/mytestxtaoxiao*virtual*machine|R ill丨1 iiTfTJTi4 在 vi 中设置行号vi temp/mytest/ma n.config:set nuX xiao) )xiao-virtual-machine: *W fr xj tz 111 d L tr U o U L U1 o L Ld L L y 1 U1 1 Mall C. U11 1 * L13 # con fiou rc sc riotH W 23|T T-厂ZX Fit HHi Fl + T jft ZlJ 1 rw H 1 t L III1 VZ1 1 1 10 1 1 & 76 #7

4、 it匚ciT rnArp 1 inFArrhAliAHnhcii十f* k 1 c尸ill户c.*11 # when MANPATH contains an empty substrtnc :set nu1,1顶端5 移动到第 58 行,向向后定位到第二对双引号,请问你看到的双引号内是什么目录:58 然后/” n n第二对双引号内是/dir/bin/fooX xiaoxiao-virtual-machine: 54 # MANPATH/usr/kerberos/man56 # Set Up PATH to MANPATH mappingJ * rr58# If people ask for

5、man foonand have i/dir/bin/fooHin their PATH59# nd the3启found In11/dir/nan11thmn no maDDinorQuired6 #61ff The below mappings are superfluous when the right hand side is62# In the n arida to厂y ndnpt h dlrtbut willHdn f rOHst Atting63# lots of other nearby files and dlrectortes,r58,4040%6 移动到第一行,并且向下查

6、找一下“ bzip2 这个字符串,请问它在第几行/bzip2 在 118 行xlao) )xlao-virtual-machine: “113#114CMP/usr/bin/cmp -s115#116#匚onpress tat pages117#118COMPRESS/usr/bin/0zip2119COMPRESS_EXTbz2120#_121# Default nanual secttons (and order : to search if -S is not specified122# and the MANSECT envtronment variable is notsection

7、s are ued by118,19-2685%7 将第 50 行到 100 行之间的”mar 改为” MAN 并且一个一个查看是否需要修改,如何执行命令?如果在查看过程 中一直按 y,结果在最后一行出现改变了几个man?:50,100s/man/MAN/gc49Uncon menit if you want to include one of theseby default5351M A ND/LTH/opt/*/MAN52JUL A kiDAOMPlrATH/u s r/lib/*/MAN53* |k H|LJKnftilrATHyusr/shorc* * *MAm / nW54MAMDA

8、TH/usr/kerbei厂f LBRkl13 fIrHL 1T|5556#L Up IP ATH to MANPATH Fapping5758If peoplQ3 s Ic for11MANfoor,and have /di厂/bin/foo!in thetr P/59F r% /-J-4dllu Idocs are found tn11/dir/EffilM, then nopiaDDlno Is reau1196,1+&1 J J为MAN iy/n/a/q/l/AE/AY)?159,3536%8 不想修改了,想还原成原始文件,如何做:e!X xhofQJxidO-virtual-mach

9、fne: *r -M-(F78 #NOAUIOPATH70 ifrFT80# NOCACHE kcps nn fron匸eating cchc p日gE ( cat p日ges)81# (generally one enables/disable cat page creation by ereating/deleting823 the dire匚toy they would live tn - Plan never does mkdtr)c r *jjf84 ffNOCACHEQr #0 FT86# Useful paths - not亡that COL should not be defi

10、ned when87# NROFF is defined as groff -Tascii10 11orhgroff -Tlatinl;何p/mytmst/man.CQnfig 141.L# 461982# 15E%9 复制 65 行到 73 行的内容,并且粘帖到最后一行之后:65,73t$10 21 到 42 行的开头为#的这些行都删掉,如何做:22 然后 22dd146141142143144145146147148149150_多了9行MANPATHMAPMANPATHMAPMANPATHZMAPMANPATHZMAPMANPATH_MAPMANPATHZMAPMANPATHZMAPMA

11、NPATHZMAPJANPATHMAP156,1底端X xhoxho-vfrtual-machlne:鹽I18# MANPATHman pa th_ element cor respond in g_c a tdiir 19# MANPATH MAPpath_elenent Pianpath elenentJLK)FF21BANPATH /usr/man22HANPATH /usr/share/man23MAN PATH /usr/local/man24HANPATH /usr/local/share/man25HAN PATH /usr/XHR6/man26n27ff UncOHPHCnt

12、if you want to in匚lud已one of th已s巳by default28n29#MANPATH/opt/*/man30#MANPATH/usr/lib/*/man31#MANPATH/usr/share/*/man32#MANPATH/usr/kerberos/man33n少了22行21,115%11 将这个文件另存为ma n.test.co nfig:w man .test.c onfigHANPATH12 去掉第 27 行,并且删除前 15 个字符,现在第一个字符是什么:2715x现在第一个字符是 yiao) )xiao-virtuaLmachIne: */temp/m

13、ytestnanesponigBl 1 A L| A TpiathL.MANPAT24MANPAT25/ustFman.test.config1新128L, 4101C已写入21,115%MANPAT19X xlao(3)xfao-virtual-machine: */temp/mytest18 # MANPATHpna n p ath Elementrrespcnding_catrH厂119 # MANPATHMAPpath e亡n tmai1D t h E j L Qncn t20#21MANPATH /usr/man22MANPATH /usr/share/man23MANPATH /u

14、sr/local/man24MANPATH /usr/Xocdl/share/man25MANPATH /usr/XllRG/man26#27Qou wnnt to include one of these by default28#29#MANPATH/opt/*/man30#MANPATH/usr/lib/*/man31#MANPATH/usr/share严/man32#MAhlPATH/usr/kerberos/man33#:2727,1IS%13 在第 1 行新增一行lam a student.,现在文件开头的两行是什么样的:1 O现在文件开头的两行是I am a stude nt#1

15、4 保存后离 xiao) )xiao-vktual-machine: /temp/mytest3Geneaut omatically from man.conf.in by ttie4M*configu rescr ipt +6JUrnan * snf fronnan-1.6d8ff-Fornorc tnfo rmattonabout this file,see the nan pages man(1)9andnan + conf ( c ie禅114J1.Thisfile4 read byman ta configurethe default manpath (alsoused12whenM

16、ANPAF H contsLns an empt歩substring), to find out where thecat13poges corrCsp ondtngto gien man pagesshould be stored,14andto napea ch PATHelenent to a nanpath elenent *ISIt nay alsoccord the pathname of theman binary* This is unused,16Theformat:21,14:q!I实验二文件与目录权限练习题目:假设系统中有两个帐号 apple 与 orange,这两个人除

17、自己的用户组外,还同属于一个用户组app。假设这个用户组的成员共同拥有/project/app/目录的开发权,且该目录不许其他人查阅。请问该目录的权限应怎样设置。(需要使用 root 身份来进行 chmod, chgrp 等操作,帮用户设置好开发环境,可保证开发项目的私密性)。步骤:1 root 身份下,新建两个帐号,并使其属于同一用户组app (注意如何启用两用户)新建账户 appleam a studenQFiNn.config 12今L, 4101C已写入顶端xtaoxtaOvirtual-machine:-$ sudo adduser apple sudo password for x

18、tao:正在漏加用户apple 正在添加新组apple (1861).正在添加新用户apple (1001)到组apple主目录7home/appleir已经存在。沒有从/etc/skel复制文件。输入薪的UNIX磁码: 重新输入新的UNIX密码:passwd :已成功更新密码 正在改变apple的用户信息 请输入新值f或直接敲回车键以使用默认值全名:房间号码:工作电话:家庭电话: 其它: 这些信息是否正确?/n yxtaogxiaOvirtual-machine:-$ |新建账户 orangeX xhoxldo-virtual-machine: xiaoxiao-virtual-machin

19、e:-$ sudo adduser orange正在添加用户orange正在療加新组orange (1002)正在济加新用户orange (1602)到组orange . -主目亲“/ho陀/oenge已经存在。没有从/弍:“展1”复制文件 输入新的UNIX密码:重新输入新的UNIX密码:passwd :已成功更新密码正在改变orange的用户信息请输入新值,或直接敲回车键以使用默认值全名:房间号码:工作电话:家庭电话:其它:这些信息量否正确?Y/n y新建组 app4 实际用两用户测试看看是否可以正常工作,用apple 建立文件,用 orange 修改,是否可以。如果有问题如何解决。xtso

20、xiaovirtualmachinegroupadd app groupadd: Permtsston denied.groupadd :无法锁定/etc/groupF请稍后再试&xiaoxtao-virtual-machinesudo groupadd app sudopassword for xiao: xtaoxiao-virtual-piachine:$ |把 apple 禾口 orange 归为同一组 appxiaogxiao-virtual-machine:*$ sudo usermod -G app apple xiaoxi.ao-virtual-machinesudo user

21、mod -G apporange xiaoxtao-virtual-machine:*$ |2 root 身份下建立开发项目目录/project/app,查看该目录权限,说明两用户 apple , orange 为什么不可以在该目录新 建文件 xlaogixiao-virtual-machlne:-xtaoxtaOvirtual-machine:-$ sudo passwordfor xiao: xtaoxiao-virtual-machine drwxr-xr-x2 root root 4096 xiaogxiao-virtual-ma匚hlnE:$ |3 进行目录的权限修改,使得两用户可以

22、在该目录下进行项目开发而,其他用户均不得进入该目录xiaaxiao-virtual-machtnezJ sudo chgrp app /project/app xtaogixtdo- virtual-machine:Ls -Id /project/appdrwxr-xr-x 2 root app 40964月25 17:02 /project/appxiaogxido-virtual-machine:$ sudo chnod 770 /project/app xtaoixiao-virtual-ma chine:Is -Id /project/appdrwxrwx- 2 root app 40964月25 17:02 /project/appxiaofflxiao-virtual*machine:$ xiaoxtao-virtual-machine:-$ su apple密码:applexiao-virtual-ma匚hirw:日cd /proje匚t/app applegxtao-virtual-machine:/praject/app$ touch filelsudo mkdir /proj

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论