The main records Tar,zip,gzip,bzip2,rar and other commonly used commands, the operation of. Tar,. GZ,. tar.gz,. tgz,. bz2,. tar.bz2,. zip,. rar, 8 kinds of compressed files.
1. Tar command
command format: tar [main option + Secondary options] File/directory
main options:C Packaging, x unpacking, T list the contents of the package * in the command, c/x/t can only exist one!
Accessibility Options:
-Z: Do I need to compress or decompress with gzip? The general format is xx.tar.gz or XX. tgz
-j: Do I need to compress or decompress with bzip2? The general format is xx.tar.bz2
-V: Show Files * Common
-F: Use package name * Generally put last, followed by direct parking name
-P: Use original file properties (attributes are not changed according to user)
--exclude file: In the process of compression, file is not packaged
Tar-CVF Archive.TarFoo Bar #将foo和bar文件打包成 Archive.Tar, no compressionTar-ZCVF Archive.Tar. gz foo #将foo文件打包后以gzip压缩, suffix.Tar. gz/. tgzTar-JCVF Archive.Tar. bz2 foo #将foo文件打包后以bzip2压缩, suffix.Tar. bz2Tar-TVF Archive.Tarfiles in #详细列出archive. TarTar-ZTVF Archive.Tar. GZ #详细列出archive.Tarfiles in. gz, z-parameters are requiredTar-XVF Archive.Tar#拆包解压到当前文件夹Tar-ZXVF Archive.Tar. gz./test #解压到test文件夹中
2. zip command
Command format:
compression:zip [options] [file name after packaging] [packaged files/directories]
decompression:unzip [options] [. zip file]
Zip archive. zip foo #将foo文件打包压缩成archive. Zipzip -M archive. zip foo #将foo文件打包压缩成archive. Zip after deleting foounzip archive. Zip #解压缩 unzip -l archive. Zip the file in the #列出archive. zip Unzip archive. Zip -D./test #将archive. zip to the test directory
3. GZIP/BZIP2 command
Command format:
compression:gzip [options] [file name after package] [packaged files/directories]
decompression:gzip-d [. GZ filename]
gunzip [. GZ filename]
* bzip2 the same as gzip usage
gzip foo #将foo文件打包成foo. GZ, do not keep foo file gzip -l foo.gz #列出foo. gz file, no-press gzip -D foo.gz #将foo. gz to extract foo file gunzip foo.gz #将foo. gz into foo file #bzip2 As with gzip usage, the suffix is. bz2
4. rar command
The default Linux version does not support RAR compression and must be installed and used under Ubuntu: sudo apt-get install rar for installation.
command format: rar [Options] [file name after packaging] [Packaged files/directories]
rar a test.rar foo #将foo文件打包成test. Rarrar x test.rar #将test. rar extract to current directory rar x test.rar. /test #将test. rar Extract to test directory
Linux compression and decompression common commands