首页 > 系统服务 > 详细

《linux系统及其编程》实验课记录(四)

时间:2014-03-26 07:21:27      阅读:590      评论:0      收藏:0      [点我收藏+]

实验4:组织目录和文件

实验目标:

熟悉几个基本的操作系统文件和目录的命令的功能、语法和用法, 整理出一个更有条理的主目录,每个文件都位于恰当的子目录。


实验背景:

你的主目录中已经积压了一些文件,你决定开始规整它们。你打算新建几个子目录,然后复制或转移文件来适应这个新方案。此外,你还有一些不需要的文件,它们必须被删除。


实验要求:

1、使用ls查看文件及其属性

2、使用cd切换路径

3、使用touchmkdir创建相应的文件及文件夹

4、使用rmrmdir删除文件及文件夹


实验详解:

1、使用口令student登录为用户student。如果你使用的是图形化环境,点击[应用程序(Applications)]->[附件(System Tools)]->[终端(Terminal)]来打开终端:


2、登录到系统之后,你应该就位于你的主目录中。使用pwd”(打印工作目录)命令

来校验:

[student@desktopX ~]$ pwd

/home/student


3、使用一下每个命令来检查你的主目录中的文件:

ls

ls–a

ls-al

观察返回的文件数量有何不同。


4、现在,你将使用touch命令来创建该练习序列的文件,输入:

[student@desktopX ~]$ touch {report,graph}_{jan,feb,mar}


5、使用ls命令来检查前一个命令执行的结果。你应该看到你的主目录中新建了一下六个空文件:

[student@desktopX ~]$ ls

graph_feb

graph_jan

graph_mar

report_feb

report_jan

report_mar


6、为了组织文件,你必须首先新建一些目录。使用mkdir命令来新建目录。在更改目录时,请确定当前工作目录和预料中一样:

[student@desktopX ~]$ mkdir Projects

[student@desktopX ~]$ mkdir Projects/graphs

[student@desktopX ~]$ cd Projects

[student@desktopX Projects]$ cd Projects

[student@desktopX Projects]$ mkdir reports

[student@desktopX Projects]$ cd reports

[student@desktopX reports]$ mkdir ../Backups

使用ls命令来检查你的工作结果:

[student@desktopX reports]$ cd

[student@desktopX ~]$ ls -l



7、首先,把所有文件名中带有graph的文件都转移到Projects目录中的graphs子目录中。分两个步骤来完成:

第一步:转移一个文件

第二步:转移两个文件

[student@desktopX ~]$ mv graph_jan Projects/graphs

[student@desktopX ~]$ mv graph_feb graph_mar Projects/graphs

[student@desktopX ~]$ ls -l Projects/graphs



8、下一步,把两个report”文件移动到Projects目录中的reports子目录中。使用这些命令来转移这些文件:

[student@desktopX ~]$ mv report_jan report_feb Projects/reports

[student@desktopX ~]$ ls –l Projects/reports

totol 2

-rw-rw-r--1 student student 0 Sep 30 21:08 report_feb

-rw-rw-r--1 student student 0 Sep 30 21:08 report_jan



9、删除剩下的report文件:

[student@desktopX ~]$ rm report_mar

[student@desktopX ~]$ ls Projects


10、转换到Backups的目录,January文件复制到这个目录中。一个文件使用绝对路径名复制,另一个文件使用相对路径名复制:

[student@desktopX ~]$ cd Projects/Backups

[student@desktopX Backups]$ pwd

/home/student/Projects/Backups

[student@desktopX Backups]$ cp ../reports/report_jan .

[student@desktopX Backups]$ cp /home/student/Projects/graphs/graph .

//’.’表示当前工作的目录


11、注销,或运行exit命令来关闭图形化终端。

 


 

 

实验记录:

2.

bubuko.com,布布扣

3.

bubuko.com,布布扣

4.

bubuko.com,布布扣

5.

bubuko.com,布布扣

6.

bubuko.com,布布扣

7.

bubuko.com,布布扣

8.

bubuko.com,布布扣

9.

bubuko.com,布布扣

10.

bubuko.com,布布扣

 

Freecode : www.cnblogs.com/yym2013

《linux系统及其编程》实验课记录(四),布布扣,bubuko.com

《linux系统及其编程》实验课记录(四)

原文:http://www.cnblogs.com/yym2013/p/3624061.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!