p primary partition (1-4) p
Partition number (1-4): 3
First cylinder (501-1044, default 501): Using default value 501
Last cylinder or +size or +sizeM or +sizeK (501-1044, default 1044): 800
Command (m for help): n Command action e extended
p primary partition (1-4) e
Selected partition 4
First cylinder (801-1044, default 801): Using default value 801
Last cylinder or +size or +sizeM or +sizeK (801-1044, default 1044): Using default value 1044
Command (m for help): n
First cylinder (801-1044, default 801): Using default value 801
Last cylinder or +size or +sizeM or +sizeK (801-1044, default 1044): 900
Command (m for help): n
First cylinder (901-1044, default 901): Using default value 901
Last cylinder or +size or +sizeM or +sizeK (901-1044, default 1044): Using default value 1044
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sdb1 1 200 1606468+ 83 Linux /dev/sdb2 201 500 2409750 83 Linux /dev/sdb3 501 800 2409750 83 Linux /dev/sdb4 801 1044 1959930 5 Extended /dev/sdb5 801 900 803218+ 83 Linux /dev/sdb6 901 1044 1156648+ 83 Linux
工具及准备
1. 使用Red Hat Enterpise Linux 5.0 的虚拟机系统
实验三 Linux的基本指令 ( 操作性实验 4学时)
实验目的
1. 通过对基本的Linux指令操作,熟悉常用的Linux指令用法及其含义 2. 学会使用Linux联机帮助 3. 学会日志文件的创建和使用
实验内容
1. root登陆,进入/home目录
2. /home目录下创建一目录名为command的目录
_____mkdir_command___________________________________________________________________
3. 进入command目录,完成以下操作:cd command 1) 在command目录下,创建两个目录: dir1, dir2
__________mkdir_dir1__dir2___________________________________________________ 2) 输入dir1目录,在该目录下创建两个文件名为file1, file2的普通文件 cd dir1
______________touch__file1___file2________________________________________________________
3) 完成date > file1 操作, 并查看file1中的内容 cat file1 4) 将file1中的内容复制到file2中
______cp__file1__file2_________________________________________________________________
5) 将当前工作目录切换至dir2中
______cd_../dir2______________________________________________________________ 6) 查看当前工作目录
________pwd________________________________________________________________ 7) 将dir1中的所有文件复制到dir2中,并查找文件名为file1的文件是否在dir2中 ________cp__-r_dir1/*_dir2____________________________________________________ 8) 以长文件格式查看dir2中文件的属性,并说明其含义
_________ls__-l______________________________________________________________ ___________________________________________________________________________ 9) 将dir2中的file1更名为bacfile
_____________mv_file1___bacfile_______________________________________________ 10) 删除dir2中的file2,删除dir1中的所有文件
____________rm_file2_______________________________________________________ ___________________________________________________________________________ 11) 删除dir1和dir2,说明区别
_______rmdir__dir1__________________________________________________________ ________rm _-r__dir2____________________________________________________ 4. 将ls -l 指令伪名为longview, cat指令伪名为display, 并测试
___Alias_longview=”ls_-l”______display=cat___________________________________________________________
5. 要求所有上述操作在script文件中完成,script文件名为lab3
_____________script__lab3________exit____________________________________________________
工具/准备工作
1. Red Hat EnterpriseLinux 5.0 操作系统
实验四 Linux 系统下文件的压缩 ( 操作性实验 2学时)
实验目的
1.学会使用Linux中文件打包和解包工具
2.学会使用Linux中常用的文件压缩和解压工具
实验内容
完成并记录以下操作
1.登录Linux系统,打开“终端”
2.在/home/中创建一文件目录compress在compress目录中创建三个文件:file1, file2, file3, file4.txt.
[root@localhost root]# cd /home
[root@localhost home]# mkdir compress [root@localhost home]# cd compress
[root@localhost compress]# touch file1 file2 file3 file4.txt 3.将以上三个文件打包,包名为:comp.tar
[root@localhost compress]# tar -cvf comp.tar file1 file2 file3 file4.txt file1 file2 file3
4.浏览comp.tar中的文件
[root@localhost compress]# tar -tvf comp.tar
-rw-r--r-- root/root 0 2011-09-26 10:52:09 file1 -rw-r--r-- root/root 0 2011-09-26 10:52:09 file2 -rw-r--r-- root/root 0 2011-09-26 10:52:09 file3
5.将一新文件file4加入comp.tar中,并将file1从包文件中删除 [root@localhost compress]# tar -rvf comp.tar file4.txt file4.txt
[root@localhost compress]# tar --delete -vf comp.tar file1 [root@localhost compress]# tar -tvf comp.tar
-rw-r--r-- root/root 0 2011-09-26 10:52:09 file2 -rw-r--r-- root/root 0 2011-09-26 10:52:09 file3 -rw-r--r-- root/root 0 2011-09-26 10:52:09 file4.txt 6.将comp.tar 压缩成comp.tar.gz文件 [root@localhost compress]# gzip comp.tar [root@localhost compress]# ls
comp.tar.gz file1 file2 file3 file4.txt
7.压缩目录compress中除.txt的所有文件,压缩文件名为:compex.zip [root@localhost compress]# cd ..
[root@localhost home]# zip -r compex.zip /home/compress -x *.txt adding: home/compress/ (stored 0%) adding: home/compress/file1 (stored 0%) adding: home/compress/file2 (stored 0%) adding: home/compress/file3 (stored 0%)
adding: home/compress/comp.tar.gz (stored 0%) [root@localhost home]# ls -l