文档介绍:《操作系统原理》
实验报告书
班级:
学号:
姓名:
指导教师:
$mkdir dir1
$exit
#su stu2
$ cd~
$mkdir dir2
$exit
(3)查找 stu1 用户主目录、下属各子目录的默认存取权限,并给出结论。
#su stu1
$cd..
$ls-1
用户主目录权限为: drwx--------, 即目录的用户可读,写,执行,同组和其它的用户无任何权
限
#su stu`
$cd~
$ls-1
Dir1 目录权限为: drwxr-xr-x, 即目录的用户可读,写,执行
(4)调试 pwd 和 cd 命令,回答下列关于 Linux 文件系统中目录的有关问题。
① 用户主目录的绝对路径如何表示? /home/stu1/home/stu2
② 根目录如何表示? /root
③.和..分别表示什么目录? 子目录,父目录
④~表示什么目录? 用户主目录
⑤当前目录如何表示? Cd~
(5)新建用户 stu3,设置其密码为 student3,并将其设置为 group2 中成员。尔后,以 stu3 登
录,在其主目录下建立名为 text 的目录,在 text 目录下再建立名为 dir1 的子目录,并使
其成为当前目录。
4
#groupadd group2
#useradd stu3 –g group2
#su stu3
$passwd 回车后敲入密码 student3
$cd~
$mkdir text
$mkdir dir1
$cd text/dir1
(6)使用 cat> 命令,分析命令行 cat 的显示结果。
$ cat>
buy some sneakers
then go to the coffee shop
then buy some coff
^D
$cat
从键盘中创建一个名为 文件,文件内容为 :buy some sncakers
Then go to the coffee shop
Then buy some coff
(7)使用上题的方法,在 dir1 目录中建立 文件,其内容为:
bring the coffee home
take off shoes
put on sneakers
make some coffee
relax!
$cd /home/stu1/dir1
$cat>
Bring the coffee home
Take off shoes
Put on sneakers
Make some coffee
Relax!
[ctrl+d]
(8)试写出实现下列功能的 shell 命令:
① 将 文件移至其上级目录中(即 text 目录下)。
$mv/
② 将 添加到 尾部形成新的文件 。
5
$cat >
$cat >>
③ 将 text 目录树从 stu3 用户主目录下移至 stu2 主目录下。
【使用特权用户方法】
su
mv/home/stu3/text/home/stu2
【修改目录权限方法】
#cp/home/stu3/text/home/stu2
(9) 试画出上述命令后,用户 stu1、 stu2 和 stu3 主目录中的目录树( 3 棵子树)。