Linux zipinfo命令用于列出压缩文件信息。
执行zipinfo指令可得知zip压缩文件的详细信息。
zipinfo [-12hlmMstTvz][压缩文件][文件...][-x <范本样式>]
参数:
显示压缩文件信息
[root@w3cschool.cc a]# zipinfo cp.zip Archive: cp.zip 486 bytes 4 files -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 a.c -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 b.c -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 c.c -rw-r--r-- 2.3 unx 0 bx stor 24-May-10 18:54 e.c 4 files, 0 bytes uncompressed, 0 bytes compressed: 0.0% [root@w3cschool.cc a]#
显示压缩文件中每个文件的信息
[root@w3cschool.cc a]# zipinfo -v cp.zip Archive: cp.zip 486 bytes 4 files End-of-central-directory record: ------------------------------- Actual offset of end-of-central-dir record: 464 (000001D0h) Expected offset of end-of-central-dir record: 464 (000001D0h) (based on the length of the central directory and its expected offset) This zipfile constitutes the sole disk of a single-part archive; its central directory contains 4 entries. The central directory is 248 (000000F8h) bytes long, and its (expected) offset in bytes from the beginning of the zipfile is 216 (000000D8h). There is no zipfile comment. Central directory entry #1: --------------------------- a.c offset of local header from start of archive: 0 (00000000h) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment. Central directory entry #2: --------------------------- b.c offset of local header from start of archive: 54 (00000036h) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment. Central directory entry #3: --------------------------- c.c offset of local header from start of archive: 108 (0000006Ch) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment. Central directory entry #4: --------------------------- e.c offset of local header from start of archive: 162 (000000A2h) bytes file system or operating system of origin: Unix version of encoding software: 2.3 minimum file system compatibility required: MS-DOS, OS/2 or NT FAT minimum software version required to extract: 1.0 compression method: none (stored) file security status: not encrypted extended local header: no file last modified on (DOS date/time): 2010 May 24 18:54:26 file last modified on (UT extra field modtime): 2010 May 24 18:54:26 local file last modified on (UT extra field modtime): 2010 May 24 10:54:26 UTC 32-bit CRC value (hex): 00000000 compressed size: 0 bytes uncompressed size: 0 bytes length of filename: 3 characters length of extra field: 13 bytes length of file comment: 0 characters disk number on which file begins: disk 1 apparent file type: binary Unix file attributes (100644 octal): -rw-r--r-- MS-DOS file attributes (00 hex): none The central-directory extra field contains: - A subfield with ID 0x5455 (universal time) and 5 data bytes. The local extra field has UTC/GMT modification/access times. - A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes. There is no file comment.
Linux zip 命令用于压缩文件。
zip 是个使用广泛的压缩程序,压缩后的文件后缀名为 .zip。
zip [-AcdDfFghjJKlLmoqrSTuvVwXyz$][-b <工作目录>][-ll][-n <字尾字符串>][-t <日期时间>][-<压缩效率>][压缩文件][文件...][-i <范本样式>][-x <范本样式>]
参数:
将 /home/html/ 这个目录下所有文件和文件夹打包为当前目录下的 html.zip:
zip -q -r html.zip /home/html
如果在我们在 /home/html 目录下,可以执行以下命令:
zip -q -r html.zip *
从压缩文件 cp.zip 中删除文件 a.c
zip -dv cp.zip a.c
Linux unzip命令用于解压缩zip文件
unzip为.zip压缩文件的解压缩程序。
unzip [-cflptuvz][-agCjLMnoqsVX][-P <密码>][.zip文件][文件][-d <目录>][-x <文件>] 或 unzip [-Z]
参数:
查看压缩文件中包含的文件:
# unzip -l abc.zip Archive: abc.zip Length Date Time Name -------- ---- ---- ---- 94618 05-21-10 20:44 a11.jpg 202001 05-21-10 20:44 a22.jpg 16 05-22-10 15:01 11.txt 46468 05-23-10 10:30 w456.JPG 140085 03-14-10 21:49 my.asp -------- ------- 483188 5 files
-v 参数用于查看压缩文件目录信息,但是不解压该文件。
# unzip -v abc.zip Archive: abc.zip Length Method Size Ratio Date Time CRC-32 Name -------- ------ ------- ----- ---- ---- ------ ---- 94618 Defl:N 93353 1% 05-21-10 20:44 9e661437 a11.jpg 202001 Defl:N 201833 0% 05-21-10 20:44 1da462eb a22.jpg 16 Stored 16 0% 05-22-10 15:01 ae8a9910 ? +-|¥+-? (11).txt 46468 Defl:N 39997 14% 05-23-10 10:30 962861f2 w456.JPG 140085 Defl:N 36765 74% 03-14-10 21:49 836fcc3f my.asp -------- ------- --- ------- 483188 371964 23% 5 files
Linuxuudecode 将 uuencode 编码后的档案还原, uudecode 只会将 begin 与 end 标记之间的编码资料还原,程序会跳过标记以外的资料。
uuencode [-hv] [file1 ...]</p>
参数:
将 file.uud 还原,而还原后的档名储存在 file.uud 档中。
uuencode file.uud
可以一起还原好几个档案。
uuencode file1.uud file2.uud
Linux tar(英文全拼:tape archive )命令用于备份文件。
tar 是用来建立,还原备份文件的工具程序,它可以加入,解开备份文件内的文件。
tar [-ABcdgGhiklmMoOpPrRsStuUvwWxzZ][-b <区块数目>][-C <目的目录>][-f <备份文件>][-F <Script文件>][-K <文件>][-L <媒体容量>][-N <日期时间>][-T <范本文件>][-V <卷册名称>][-X <范本文件>][-<设备编号><存储密度>][--after-date=<日期时间>][--atime-preserve][--backuup=<备份方式>][--checkpoint][--concatenate][--confirmation][--delete][--exclude=<范本样式>][--force-local][--group=<群组名称>][--help][--ignore-failed-read][--new-volume-script=<Script文件>][--newer-mtime][--no-recursion][--null][--numeric-owner][--owner=<用户名称>][--posix][--erve][--preserve-order][--preserve-permissions][--record-size=<区块数目>][--recursive-unlink][--remove-files][--rsh-command=<执行指令>][--same-owner][--suffix=<备份字尾字符串>][--totals][--use-compress-program=<执行指令>][--version][--volno-file=<编号文件>][文件或目录...]
参数:
压缩文件 非打包
# touch a.c # tar -czvf test.tar.gz a.c //压缩 a.c文件为test.tar.gz a.c
列出压缩文件内容
# tar -tzvf test.tar.gz -rw-r--r-- root/root 0 2010-05-24 16:51:59 a.c
解压文件
# tar -xzvf test.tar.gz a.c
Linux restore命令用来还原由dump操作所备份下来的文件或整个文件系统(一个分区)。
restore 指令所进行的操作和dump指令相反,dump操作可用来备份文件,而restore操作则是写回这些已备份的文件。
restore [-cCvy][-b <区块大小>][-D <文件系统>][-f <备份文件>][-s <文件编号>] 或 restore [-chimvy][-b <区块大小>][-f <备份文件>][-s <文件编号>] 或 restore [-crvy][-b <区块大小>][-f <备份文件>][-s <文件编号>] 或 restore [-cRvy][-b <区块大小>][-D <文件系统>][-f <备份文件>][-s <文件编号>] 或 restore [chtvy][-b <区块大小>][-D <文件系统>][-f <备份文件>][-s <文件编号>][文件...] 或 restore [-chmvxy][-b <区块大小>][-D <文件系统>][-f <备份文件>][-s <文件编号>][文件...]
参数:
Linux lha命令用于压缩或解压缩文件。
lha是从lharc演变而来的压缩程序,文件经它压缩后,会另外产生具有".lzh"扩展名的压缩文件。
lha [-acdfglmnpqtuvx][-a <0/1/2>/u</0/1/2>][-<a/c/u>d][-<e/x>i][-<a/u>o][-<e/x>w=<目的目录>][-<a/u>z][压缩文件][文件...] 或 lha [-acdfglmnpqtuvx][-a <0/1/2>/u</0/1/2>][-<a/c/u>d][-<e/x>i][-<a/u>o][-<e/x>w=<目的目录>][-<a/u>z][压缩文件][目录...]
参数:
缩文件
# lha -a abc.lhz a.b //压缩a.b文件,压缩后生成 abc.lhz文件
压缩目录
# lha -a abc2 /home/hnlinux
解压文件到当前目录
# lha -xiw=agis abc //解压文件abc
Linux gzip命令用于压缩文件。
gzip是个使用广泛的压缩程序,文件经它压缩过后,其名称后面会多出".gz"的扩展名。
gzip [-acdfhlLnNqrtvV][-S <压缩字尾字符串>][-<压缩效率>][--best/fast][文件...] 或 gzip [-acdfhlLnNqrtvV][-S <压缩字尾字符串>][-<压缩效率>][--best/fast][目录]
参数:
压缩文件
[root@runoob.com a]# ls //显示当前目录文件 a.c b.h d.cpp [root@runoob.com a]# gzip * //压缩目录下的所有文件 [root@runoob.com a]# ls //显示当前目录文件 a.c.gz b.h.gz d.cpp.gz [root@runoob.com a]#
接范例1, 列出详细的信息
[root@runoob.com a]# gzip -dv * //解压文件,并列出详细信息 a.c.gz: 0.0% -- replaced with a.c b.h.gz: 0.0% -- replaced with b.h d.cpp.gz: 0.0% -- replaced with d.cpp [root@runoob.com a]#
接范例1,显示压缩文件的信息
[root@runoob.com a]# gzip -l * compressed uncompressed ratio uncompressed_name 24 0 0.0% a.c 24 0 0.0% b.h 26 0 0.0% d.cpp
Linux gzexe命令用于压缩执行文件。
gzexe是用来压缩执行文件的程序。当您去执行被压缩过的执行文件时,该文件会自动解压然后继续执行,和使用一般的执行文件相同。
gzexe [-d][执行文件...]
参数:
压缩可执行文件
# gzexe abc
Linux uuencode命令用于将uuencode编码后的档案还原。
早期在许多 unix 系统的传送协定只能传送七位元字元,并不支援二进位档案,像中文文字档就有用到八位元,所以无法完整地送到另一架机器上。 uuencode 指令,可以将二进位档转换成七位元的档案,传送到另一架机器上再以 uudecode 还原。最常见的是用在以电子邮件传送二进位档。uuencode 编码后的资料都以 begin 开始,以 end 作为结束。
compress[必要参数][选择参数][目录或者文件]
参数说明:
必要参数:
选择参数:
还原档案
# uuencode test.uud