上次说过linux移动命令
Compress压缩文件
[root@test /root]# cp /etc/man.config /root
[root@test /root]# compress man.config //压缩man.config这个文件
[root@test /root]# compress -d man.config.Z //-d 解压缩这个文件
[root@test /root]# uncompress man.config.Z //解压缩这个文件
当你以 compress 压缩之后,如果没有下达其它的参数,那么原本的档案就会被后来的 *.Z 所取代!
Gzip压缩文件和zcat
[root@test /root]# gzip [-d#] filename <==压缩与解压缩
[root@test /root]# zcat filename.gz <==读取压缩档内容
参数说明:
-d :解压缩的参数!
-r :递归处理,将指定目录下的所有文件及子目录一并处理
-# :压缩等级, 1 最不好, 9 最好, 6 是默认值!
[root@test /root]# gzip man.config //会产生 man.config.gz 这个档案
[root@test /root]# zcat man.config.gz //会读取出 man.config 的内容
[root@test /root]# gzip -d man.config.gz
[root@test /root]# gunzip man.config.gz
解压缩,产生 man.config 这个档案
[root@test /root]# gzip -9 man.config //以最大压缩比压缩 testing 这个档案!
[root@test /root]# gzip -r filename.gz file1 file2 file3 /usr/work/school
//file1、file2、 file3、以及 /usr/work/school 目录的内容(假设这个目录存在)压缩起来,然后放入 filename.bz2 文件中
Bzip2压缩文件和bzcat
[root@test /root]# bzip2 [-dz] filename <==压缩解压缩指令
[root@test /root]# bzcat filename.bz2 <==读取压缩文件内容指令
参数说明:
-d :解压缩的意思!
-z :压缩的意思!
范例:
同样的,我们以刚刚拷贝过来的 /root/man.config 这个档案为例
[root@test /root]# bzip2 –z man.config
[root@test /root]# bzcat man.config.bz2
[root@test /root]# bzip2 –d man.config.bz2
[root@test /root]# bunzip2 man.config.bz2
[root@test /root]# bzip2 filename.bz2 file1 file2 file3 /usr/work/school
//file1、file2、 file3、以及 /usr/work/school 目录的内容(假设这个目录存在)压缩起来,然后放入 filename.bz2 文件中
Tar压缩文件
[root@test /root]# tar [-zxcvfpP] filename
[root@test /root]# tar -N 'yyyy/mm%
评论