linux系统管理习题

上传人:第*** 文档编号:30581036 上传时间:2018-01-30 格式:DOCX 页数:11 大小:75.68KB
返回 下载 相关 举报
linux系统管理习题_第1页
第1页 / 共11页
linux系统管理习题_第2页
第2页 / 共11页
linux系统管理习题_第3页
第3页 / 共11页
linux系统管理习题_第4页
第4页 / 共11页
linux系统管理习题_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《linux系统管理习题》由会员分享,可在线阅读,更多相关《linux系统管理习题(11页珍藏版)》请在金锄头文库上搜索。

1、第四章 shell 命令1、启动 linux 系统,进入默认的目录,在当前路径下添加新用户 student,并设置该用户的登录密码,再显示已登录的用户(只输出用户名和用户数)rootbogon # cd /homerootbogon home# useradd student正在创建信箱文件: 文件已存在rootbogon home# passwd student更改用户 student 的密码 。新的 密码:重新输入新的 密码:passwd: 所有的身份验证令牌已经成功更新。2、切换到 student 用户的用户主目录下;在 student 用户主目录下创建一个临时目录 tmp;在临时目录下

2、创建一个文件,文件名为 a.txt;将 a.txt 复制成b.txt;将 b.txt 改名成 c.txt;为 c.txt 创建符号链接,链接文件名为 linkc.txt;使用 gzip 压缩创建/etc 的归档,将文件另存为/home/student/tmp/etc.tar.gz;将压缩的归档文件解压到/backups 目录;删除 tmp 目录rootbogon home# cd studentrootbogon student# mkdir tmprootbogon student# lstmprootbogon student# cd tmprootbogon tmp# touch a.t

3、xtrootbogon tmp# lsa.txtrootbogon tmp# cp a.txt b.txtrootbogon tmp# lsa.txt b.txtrootbogon tmp# mv b.txt c.txtrootbogon tmp# lsa.txt c.txtrootbogon tmp# ln -s c.txt linkc.txtrootbogon tmp# lsa.txt c.txt linkc.txtrootbogon tmp# tar -zcvf /home/student/tmp/etc.tar.gz /etcrootbogon tmp# cd /backupsroot

4、bogon tmp# tar -zxvf /home/student/tmp/etc.tar.gzrootbogon # ls /backupsetcrootbogon # cd /home/studentrootbogon student# rm -r tmprm:是否进入目录tmp? yrm:是否删除符号链接 tmp/linkc.txt?yrm:是否删除普通空文件 tmp/c.txt?yrm:是否删除普通文件 tmp/etc.tar.gz?yrm:是否删除普通空文件 tmp/a.txt?yrm:是否删除目录 tmp?yrootbogon student# lsrootbogon stude

5、nt# 3、列出用户主目录下的所有目录文件;列出所有属主权限为 rwx 的文件; 打印 /etc/passwd 中冒号之间是三位数的行;列出 /usr/share/doc 中以数字 4 结尾的文件;列出 /etc/hosts 中包含数字的所有行 ;打印 /etc/hosts 中包含 127.0.0.1 的行rootbogon # cd /homerootbogon home# lsguo liukang studentrootbogon home# ls -l|grep rwxdrwx-. 4 student student 4096 6 月 6 04:34 guodrwx-. 30 liuk

6、ang liukang 4096 6 月 9 07:14 liukangdrwx-. 4 student student 4096 6 月 22 00:29 studentrootbogon home# grep :0-90-90-9: /etc/passwdgames:x:12:100:games:/usr/games:/sbin/nologinusbmuxd:x:113:113:usbmuxd user:/:/sbin/nologinavahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin

7、rtkit:x:499:499:RealtimeKit:/proc:/sbin/nologinabrt:x:498:498:/etc/abrt:/sbin/nologinsaslauth:x:497:495:Saslauthd user:/var/empty/saslauth:/sbin/nologinpulse:x:496:494:PulseAudio System Daemon:/var/run/pulse:/sbin/nologinliukang:x:500:500:小康维尼:/home/liukang:/bin/bashstudent:x:501:501:/home/student:/

8、bin/bashrootbogon home# ls /usr/share/doc | grep 4$attr-2.4.44audit-2.0.4authconfig-6.1.4coreutils-8.4cronie-1.4.4cups-pk-helper-0.0.4dbus-1.2.24desktop-effects-0.8.4DeviceKit-power-014dmz-cursor-themes-0.4dracut-004dracut-kernel-004efibootmgr-0.5.4enscript-1.6.4file-5.04foomatic-4.0.4gcc-4.4.4gdm-2

9、.30.4gedit-2.28.4gnupg2-2.0.14groff-1.18.1.4gtk2-engines-2.18.4hal-0.5.14ibus-1.3.4iwl4965-firmware-228.61.2.24keyutils-libs-1.4libcap-ng-0.6.4libdaemon-0.14libgcc-4.4.4libglade2-2.6.4libgomp-4.4.4libiptcdata-1.0.4libogg-1.1.4libpng-1.2.44libraw1394-2.0.4libspectre-0.2.4libtiff-3.9.4libXfixes-4.0.4l

10、ibXres-1.0.4libXvMC-1.0.4lohit-gujarati-fonts-2.4.4lohit-punjabi-fonts-2.4.4lua-5.1.4mailx-12.4MAKEDEV-3.24nautilus-2.28.4openobex-1.4pakchois-0.4pbm2l2030-1.4pciutils-3.1.4pnm2ppa-1.04poppler-0.12.4portreserve-0.0.4python-mako-0.3.4rdate-1.4redhat-logos-60.0.14setup-2.8.14smp_utils-0.94sysstat-9.0.

11、4system-config-users-1.2.104traceroute-2.0.14unique-1.1.4urw-fonts-2.4ustr-1.0.4xmlrpc-c-1.16.24xorg-x11-drv-openchrome-0.2.904zd1211-firmware-1.4rootbogon home# grep 0-9 /etc/hosts192.168.58.128 bogon # Added by NetworkManager127.0.0.1localhost.localdomain localhost:1 bogon localhost6.localdomain6

12、localhost6rootbogon home# grep 127.0.0.1 /etc/hosts127.0.0.1localhost.localdomain localhost4、写出一条命令,统计 memo 文件的行数,将结果写入 memo.size 文件中;在当前目录下创建子目录 test,而后进入 test 子目录,并在其下创建名为 myfile.txt的文件,并通过键盘将“hello world”字符串输入到 myfile.txt 文件中,创建另一个文件 file2,将 myfile.txt 与 file2 合并为分 file3。rootbogon # cd /homerootb

13、ogon home# touch memorootbogon home# touch memo.sizerootbogon home# lsguo liukang memo memo.size studentrootbogon home# wc memo | cat memo.sizerootbogon home# cat memo.size0 0 0 memorootbogon home# mkdir testrootbogon home# cd testrootbogon test# touch myfile.txtrootbogon test# cat myfile.txthellow

14、worldCrootbogon test# cat myfile.txthellow worldrootbogon test# cat file2Crootbogon test# cat file2 myfile.txt file3rootbogon test# cat file3hellow world5、在/root 目录下,创建一个以自己的姓的拼音命名的文件夹,复制文件/etc/fstab 到该文件夹下,文件名字不变。查看文件/root/某文件夹/fstab 的前4 行;统计目录/root 下,所有目录文件的个数 rootbogon test# cd /rootrootbogon # m

15、kdir liurootbogon # cp /etc/fstab liurootbogon # ls liufstabrootbogon # head -4 liu/fstab# /etc/fstab# Created by anaconda on Mon Apr 21 05:43:19 2014rootbogon # ll总用量 112-rw-r-r-. 1 root root 0 4 月 21 01:36 =-rw-r-r-. 1 root root 0 6 月 15 23:42 :a.bin-rw-. 1 root root 2717 4 月 21 08:57 anaconda-ks.cfgdrwxr-xr-x. 2 root root 4096 6 月 22 01:31 Desktopdrwxr-xr-x. 2 root root 4096 4 月 21 06:36 Documentsdrwxr-xr-x. 2 root root 4096 4 月 21 06:36 Downloads-rw-r-r-. 1 root root 0 6 月 15 08:54 echo-rw-r-r-.

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 外语文库 > 英语学习

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号