Linux中文件的压缩与解压缩命令操作示例集锦
所谓压缩就是将原有的文件通过不同的编码技术进行运算,以减少数据存储所需要的空间,使用前再利用解压缩还原源文件的内容即可。
和wdows一样,在lux下也存在多种压缩与解压缩方法。
1、zip压缩与解压缩
zip是最为广泛使用的压缩程序,经它压缩的文件会产生扩展名为zip的压缩文件,而且这种格式在多种系统上可以使用,像wdows中的wzip
下面看一下在lux中如何建立zip文件。
我们在终端中输入zip会出现这个命令的一些介绍和参数的意义。
复制代码
xiaopeng@ubuntu:~/test$ zip
Copyright (c) 1990-2006 Info-ZIP - Type 'zip "-L"' for software license.
Zip 2.32 (June 19th 2006). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can clude the special name - to press standard put.
If zipfile and list are omitted, zip presses std to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries zipfile -m move to zipfile (delete files)
-r recurse to directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 press faster -9 press better
-q quiet operation -v verbose operation/prt version fo
-c add one-le ments -z add zipfile ment
-@ read names from std -o make zipfile as old as latest entry
-x exclude the followg names -i clude only the followg names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extractg exe -J junk zipfile prefix (unzipsfx)
-T test zipfile tegrity -X eXclude eXtra file attributes
-y store symbolic lks as the lk stead of the referenced file
-R PKZIP recursion (see manual)
-e encrypt -n don't press these suffixes
下面我们就最简单的实验一下。我们就是把当前目录下文件名以test开头的所有文件压缩文一个文件,并可以查看一下压缩比。(红色是我的注释)
复制代码