实验二 Linux 常用命令使用
一、实验目的
1.掌握 Linux 一般命令格式。
2.掌握有关文件和目录操作的常用命令。
3.掌握有关进程操作的常用命令。
4.熟练使用 man 命令。
二、实验内容
.熟悉 cd、date pwd、cal、who、echo、clear、passwd等常用命令。
2.在用户主目录下对文件进行操作:复制一个文件、显示文件内容、查找指定 内容、排序、文件比较、文件删除等。
对目录进行管理:创建和删除子目录、改变和显示工作目录、列出和更改文 件权限、链接文件等。
利用man命令显示date、echo等命令的手册页。
显示系统中的进程信息。
三、主要实验步骤
1 .登陆进入系统,修改个人密码。
.使用简单命令:date、cal、who、echo、clear等,了解Linux命令格式。
浏览文件系统 ;
运行 pwd 命令,确定当前工作目录。
运行ls -命令,理解各字段含义。
运行ls -i命令,理解各字段含义。
⑷ 使用cd命令,将工作目录改到根(/)上。运行ls -命令,结合教材中图2.2, 了解各个目录的作用。
直接使用cd,通过pwd指令验证目录位置。
用 mkdir 建立一个子目录 subdir。
将工作目录更改到 subdir。
文件操作:
(1) 验证当前工作目录在 subdir。
⑵运行date>file1,然后运行cat filel,看到什么信息?
(3)运行cat subdir,会出现什么结果?为什么?
⑷利用man命令显示date命令的使用说明。
⑸ 运行man date>>file1,看到什么信息?运行 cat filel,看到什么信息?
⑹利用ls - filel,了解链接计数是多少?运行ln filel ../fa,再看看链接计数有 什么变化?用cat命令显示fa文件内容。
⑺显示filel的当前10行,后19行。
运行cp file1 file2,然后ls -,看到什么信息?运行 mv file2 file3,然后ls -,
看到什么信息?运行cat f*,结果如何?
运行rm file3,然后ls -,结果如何?
在/etc/passwd文件中查找合适你的注册名的行。
运行ls -,理解各文件的权限是什么?
用两种方式改变file1的权限。
统计file1文件的行数、字数。
运行man ls|more,显示结果是什么?运行 cat file1|head -20|tee file5结果如 何?运行cat file5|wc,结果如何?
X - n jyyOHjbUCtu: /
cd /
jyy@ubuntu:/$ Is -I
total 96
drwxr-xr-x
2
root
root
4Q96
Sep
19
00:40
bln
drwxr-xr-x
3
root
root
4096
Sep
19
&1:&6
boot
drwxr-耳r-x
2
root
root
Sep
19
cdron
drwxr *xr *x
IS
root
root
4320
act
16
07:38
dev
drwxr-xr-x
134
root
root
12288
Oct
16
37:39
etc
drwxr-xr-x
3
root
root
4096
Sep
19
00:31
hone
Irwxrwxrwx
1
root
root
32
Sep
19
00: 40
inttrdAng
boot/init「d-ing-3.8.0-
19'generic
Irwxrwxrwx
1
root
root
33
Sep
19
00:19
tnttrd Ang ,ctd
-> /boot/tnttrd-ing-3
.8.0-19-generic
drwxr-xr *x
22
root
root
4096
Sep
19
00:40
lib
drwx
2
root
root
16384
Sep
19
80:19
lost-i-found
drwxr-xr-x
3
root
root
4096
Apr
24
10:12
(nedie
drwxr*xr*x
2
root
root
4096
Apr
19
02:03
mnt
drwxr-xr-X
2
root
root
4Q96
Sep
19
01:06
opt
dr-xr-xr-x
193
root
root
6
Oct
16
07:38
proc
d rwx
3
root
root
4096
Sep
19
root
drwxr-xr-x
23
root
root
aae
act
16
07:39
run
drwxr-xr-x
2
root
root
122&8
Sep
19
01:O6
sbtn
drwxr-xr-x
2
root
root
4096