File Compression command - compression and decompression command

File Compression command - compression and decompression command

1: (1) zip command

.zip ".zip" Windows is the most popular compression formats, Linux can correctly identify the ".zip" format, which can be easily and Windows systems common compressed file.

zip [options] source file or archive name the source directory -r: Compression directory

Example: zip -r vi.zip vitest

adding: vitest/ (stored 0%)

adding: vitest/vi.text (deflated 64%)

adding: vitest/.con.sqx.swp (deflated 97%)

adding: vitest/con.sqx (deflated 53%)

adding: vitest/test.zip (stored 0%)

 

(2) unzip command to decompress

-d represents the decompressed position

unzip -d /tmp/ ana.zip

 

2: .gz format does not packed

(1) ". Gz" Linux is the most commonly used form of compression format, using gzip compression command, the basic information is as follows. Compressed files or directories.

gzip [options] source file

The compressed data output to standard output, may be used to keep the source files: -c

-d: Unzip

-r: Compression directory

 

gzip -c anaconda-ks.cfg > anaconda-ks.cfg.gz

# -C option, but not to the compressed data output to the screen, but is redirected to a compressed file

# This will not delete the source files in the same time compressed files

 

(2). Solution ".gz" compressed format command.

[root@localhost ~]# gunzip log.gz

[root@localhost ~]# gzip -d abc.gz

gzip -r extract the directory when the package will not decompress the file or folder

 

3 .bz2

".Bz2" compression format command is bzip2.

bzip2 [options] source file

-d: Unzip

-k: compression, leaving the source file

-v: Displays detailed information compressed

 

Solution ".bz2" compression format command

[root@localhost ~]# bunzip2 cfg.bz2

[root@localhost ~]# bzip2 -d log.bz2

 

4. ".Tar" format does not compress packing

".Tar" reconciliation package packaging format are using the tar command above, except for options. Let's look at the basic information about the tar command.

Command name: tar.

English original intent: tar.

The path: / bin / tar.

Execute permissions: All users.

Description: packaged with solution packaging commands.

The basic format of the command is as follows:

[Root @ localhost ~] # tar [options] [-f archive name] source file or directory

-c: Packaging

-f: Specifies the file name of the archive. Compression extension package is used to identify the format of the administrator, so be sure to specify the correct extension.

-v: display package file process.

 

-x: Packaging Solutions

-f: Specifies the archive file name

-v: display process solution package file

-t: test, is puzzled pack, just to see what package a file // view the contents of the archive.

-C (large) Contents: Packaging Solutions designated location

 

5 .tar.gz 和 tar.bz2

tar [options] source file or directory archive

Options:

-z: compress and decompress ".tar.gz" format

-j: compression and decompression ".tar.bz2" format

takes -zcvf tmp.tar.gz / tmp /

takes -zxvf tmp.tar.gz

tar -zcvf con.sqx.tar.gz con.sqx

.tar.bz2 format

[root@localhost ~]# tar -jcvf tmp.tar.bz2 /tmp/

# Packaged compressed ".tar.bz2" format, pay attention to the archive file name

[root@localhost ~]# tar -jxvf tmp.tar.bz2

takes -zxvf test.tar.gz -C / tmp test / cde

Guess you like

Origin www.cnblogs.com/love-life-insist/p/11391847.html