linux系统基本命令实验原理,《操作系统原理与Linux》实验一 Linux基本命令.doc

这篇实验报告详细介绍了Linux系统的基本命令使用,包括文件操作、查看进程、内存和磁盘情况。通过创建、查看、修改文件权限、管理目录以及监控系统资源等步骤,帮助读者掌握Linux操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

《操作系统原理与Linux》实验报告

实验名称:实验一 Linux基本命令的使用

实验日期: 2011年11月1日

班 级:B09513

学 号:20094051311

姓 名:王晓珍

计算机号:

一、实验目的

1.掌握Linux中文件操作基本命令使用方法。

2.掌握Linux中查看进程、内存和磁盘情况基本命令的使用方法。

二、实验内容

1.登录Linux系统。/root

2.用pwd命令显示用户登录后所处的用户主目录。

3.用以下三个命令显示用户主目录中的内容,并比较命令之间的区别。

ls

a.out example.c greet hello.c hello.o netatate.txt

delete get greet.c hello.h hello.s partitioninfo

delete.c get.c hello hello.h.gch Mail wang

Desktop get.o hello,c hello.i makefile

ls –a

a.out example.c greet hello.c hello.o netatate.txt

delete get greet.c hello.h hello.s partitioninfo

delete.c get.c hello hello.h.gch Mail wang

Desktop get.o hello,c hello.i makefile

ls -al

a.out example.c greet hello.c hello.o netatate.txt

delete get greet.c hello.h hello.s partitioninfo

delete.c get.c hello hello.h.gch Mail wang

Desktop get.o hello,c hello.i makefile

4.在用户主目录中通过touch命令建立下列10个文件(例如:touch a):

news_oct_a1news_oct_b2 news_oct_c3 news_dec_b3work_nov_a1 work_nov_b2 work_nov_c3mail_dev_a2 mail_oct_c3games_dec_b1

[[email protected] ~]# touch news_oct_al

[[email protected] ~]# touch news_oct_b2

[[email protected] ~]# touch news_oct_c3

[[email protected] ~]# touch news_dec_b3

[[email protected] ~]# touch work_nov_a1

[[email protected] ~]# touch work_nov_b2

[[email protected] ~]# touch work_nov_c3

[[email protected] ~]# touch mail_dev_a2

[[email protected] ~]# touch mail_oct_c3

[[email protected] ~]# touch games_dec_b1

5.使用ls 命令查看目录,确认新建文件是否存在。

a.out greet hello.s news_oct_c3

delete greet.c Mail partitioninfo

delete.c hello mail_dev_a2 wang

Desktop hello,c mail_oct_c3 work_nov_a1

example.c hello.c makefile work_nov_b2

games_dec_b1 hello.h netatate.txt work_nov_c3

get hello.h.gch news_dec_b3

get.c hello.i news_oct_al

get.o hello.o news_oct_b2

6.通过ls –l命令查看文件news_oct_al的权限,并将它的权限改为任何人都可以读、写和执行。

-rw-r--r-- 1 root root 0 11月 1 16:41 news_oct_al

[[email protected] ~]# chmod 777 news_oct_al

-rwxrwxrwx 1 root root 0 11月 1 16:41 news_oct_al

7.通过mkdir命令在用户主目录中建立五个子目录:reports、september、october、november和december。在reports子目录中再建立三个子目录:1、2、3

[[email protected] ~]# mkdir reports september october noverber december

[[email protected] ~]# mkdir reports/1

[[email protected] ~]# mkdir reports/2

[[email protected] ~]# mkdir reports/3

8.将/etc/passwd文件复制到目录1下并重命名为mypasswd,给mypasswd文件建立一个硬文件链接hardpass和一个软文件链接softpass。查看mypasswd、hardpass和softpass三个文件的节点信息。

[[email protected] ~]# cp /etc/passwd reports/1

[[email protected] ~]# ls reports/1/passwd

[[email protected] ~]# cp reports/1/passwd mypasswd

[[email protected] ~]# ls mypasswd

mypasswd

9.将用户主目录中含字符串“dec”且含字符"b"的文件移动到december子目录下。

[[email protected] ~]# ls /root/*dec*b*

/root/news_dec_b3

/root/december:

games_dec_b1

[[email protected] ~]# mv games_dec_b1 december/

[[email protected] ~]# ls december/

games_dec_b1

[[email protected] ~]# mv news_dec_b3 december/

[[email protected] ~]# mv december december/

mv: 无法将目录‘december’移动至本身的子目录‘december/december’下

[[email protected] ~]# ls december/

games_dec_b1 news_dec_b3

10.将用户主目录中剩下含字符串“oct”和字符串“nov”的文件分别移动到相应月份的子目录中。

[[email protected] ~]# ls *oct*

mail_oct_c3 news_oct_a1 news_oct_b2 news_oct_c3

[[email protected] ~]# mv *oct* october

[[email protected] ~]# ls *nov*

work_nov_a1 work_nov_b2 work_nov_c3

november:

[[email protected] ~]# mv *nov* november

mv: 无法将目录‘november’移动至本身的子目录‘november/november’下

11.删除december子目录及其中的文件。

[[email protected] ~]# rmdir december

12.使用ps命令查看系统中进程的运行情况。

[[email protected] ~]# ps -l

F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD

4 S 0 16702 16642 0 75 0 - 1387 wait pts/0 00:00:00 bash

0 R 0 14605 16702 0 76 0 - 1274 - pts/0 00:00:00 ps

[[email protected] ~]#

13.使用free命令查看系统中内存的使用情况。

[[email protected] ~]# free

total used free shared buffers cached

Mem: 2074652 497236 1577416 0 19836 321116

-/+ buffers/cache: 156284 1918368

Swap: 0 0 0

14.使用df命令查看系统中磁盘空间的使用情况。

[[email protected] ~]# df

Filesystem 1K-块 已用 可用 已用% 挂载点

/dev/sda1 9912560 3856060 5544832 42% /

none 1037324 0 1037324 0% /dev/shm

/dev/sda2 10032560 53004 9979556 1% /mnt/WinC

/dev/sdb1 4006204 2869948 1136256 72% /mnt/sdb1

三、实验总结

通过本次实验,使我们更加了解了linux操作系统的命令,学会了并掌握了Linux中文件操作基本命令使用方法,还掌握Linux中查看进程、内存和磁盘情况基本命令的使用方法,通过与同学的合作以及老师的指导,使我们对linux操作系统更加的熟悉,也使课上学到的理论知识充分的应用到实践中。

展开阅读全文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值