Compressed package management

Source: Internet
Author: User
Tags gz file unpack uncompress

Contract Management

 

1. Common compression commands

. Tar c v f x z J. C = create, F = file, Z = zip, V = visible
. GZ gzip, gunzip
. Bz2 Bzip2, bunzip2
The. gzand. bz2 types are: the compression rate is different, and the. bz2 compression rate is high.
. Zip, unzip
. Rar rar a, rar x
7z 7z
. Z compress, uncompress
Now .gz and. Z are equivalent .. Tar can generate one file from multiple files, and the file size will not change much. .. The tar.gzfile is much smaller than the .gz file.

2. Concept of compressed packages

1. Package Multiple files into one file, such as tar
2. Compression: compress large-sized data into small-sized data. For example, GZ
Lossy compression:The decompressed files are different from the files before compression. The compression ratio is relatively high. Audio and Video Compression generally use lossy compression, such as MP3 and JPEG.
Lossless compression:The decompressed files are the same as those before compression. Generally, important documents use lossless compression. Ensure data consistency. Low compression rate,
Note: There is no file Suffix in Linux. But it is .tar,.gz.

2130506 of the hosts file must be small, This indicates that Bzip2 is more compressed than gzip. .

Tar xvf logbackup.tar decompress the. Tar package.

Tar xvfj logbackup.tar.bz2The command first uses the commandBunzip2 logbackup.tar.bz2Log on to logbackup.tar, and then useTar xvf logbackup.tarUnpack the package. when the package is decompressed, the original file will be overwritten. Logbackup.tar.bz2 still exists, but logbackup.tar does not exist.

Note:

To compress a directory, run the following command: Zip-r src.zip src/

In this way, a zip package of the src directory will be created. The archive level is: src.zip-> Src->...

 

RAR a packaging
RAR x unpack
Rar a logbak.rar * package and compress all files under the current directory and generate the compressed package logbak.rar.
The size of logbak.rar generated is 1426409.
RAR x logbak.rar uncompressed logbak.rar. Lossless compression.

Tar CVF package.tar firelist folderlist/*, * indicates all.

Related reprint: http://remindme.blogbus.com/logs/25006959.html

Ubuntu decompress and package commands

 

. Tar
Unpack: Tar xvf filename.tar
Package: Tar CVF filename.tar dirname
(Note: tar is packed, not compressed !)
---------------------------------------------
. GZ
Decompress 1: gunzip filename.gz
Decompress 2: gzip-D filename.gz
Compression: gzip filename
.Tar.gz and. tgz
Decompress: Tar zxvf filename.tar.gz
Compression: Tar zcvf filename.tar.gz dirname
---------------------------------------------
. Bz2
Decompress 1: Bzip2-D filename.bz2
Decompress 2: bunzip2 filename.bz2
Compression: Bzip2-Z filename
.Tar.bz2
Decompress: Tar jxvf filename.tar.bz2
Compression: Tar jcvf filename.tar.bz2 dirname
---------------------------------------------
. Bz
Extract 1: Bzip2-D filename. bz
Decompress 2: bunzip2 filename. bz
Compression: Unknown
. Tar. bz
Decompress: Tar jxvf filename.tar. bz
Compression: Unknown
---------------------------------------------
. Z
Decompress: uncompress filename. Z
Compression: compress filename
. Tar. Z
Decompress: Tar zxvf filename.tar. Z
Compression: Tar zcvf filename.tar. Z dirname
---------------------------------------------
. Zip
Decompress: unzip filename.zip
Compression: Zip filename.zip dirname
---------------------------------------------
. Rar
Decompress: RAR x filename.rar
Compression: rar a filename.rar dirname

RAR please go:Http://www.rarsoft.com/download.htmDownload!
After decompression, copy rar_static to the/usr/bin directory (Other Directories specified by the $ PATH environment variable can also be used ):
[Root @ www2 TMP] # cp rar_static/usr/bin/RAR
---------------------------------------------
. LHA
Decompress: LHA-e filename. LHA
Compression: LHA-a filename. LHA filename

For LHA, go:Http://www.infor.kanazawa-it.ac.jp /~ Ishii/lhaunix/Download!
> After decompression, copy LHA to the/usr/bin directory (Other Directories specified by the $ PATH environment variable can also be used ):
[Root @ www2 TMP] # cp LHA/usr/bin/
---------------------------------------------
. Rpm
Unpack: rpm2cpio filename. RPM | cpio-Div
---------------------------------------------
. Deb
Unpack: Ar P filename. Deb data.tar.gz | tar zxf-
---------------------------------------------
. Tar. tgz .tar.gz. tar. z. tar. BZ .tar.bz2. zip. cpio. rpm. deb. SLP. ARJ. RAR. ace. lha. lzh. LZX. LZs. ARC. SDA. SFX. lnx. zoo. cab. kar. CPT. pit. sit. sea
Decompress: Sex x filename .*
Compression: Sex a filename. * filename

Sex is only related to callProgram, It does not have the compression and decompression functions. Please note!
For sex, go:Http://sourceforge.net/projects/sexDownload!
After decompression, copy sex to the/usr/bin directory (Other Directories specified by the $ PATH environment variable can also be used ):
[Root @ www2 TMP] # cp sex/usr/bin/ Decompress and compile:
Sudo./configure
Make
Make install, of course, must be compiled with the root user, but not necessarily during decompression, what do common users do. The above are common commands, which are not commonly used. Here, I will give the brothers an image so that they can understand it. Method 2:
Sudo./configure -- prefix =/path
Make; make install

Method 3:
Sudo./configure -- enable-static-link \
-- Prefix = $ xxx/static -- With-Curses &&
Make &&
Make install

Command explanation

-- Enable-static-link: This configuration command causes Bash to be statically linked.

-- Prefix = $ xxx/static: This configuration command installs all bash files in the $ xxx/static directory, this directory will be a/static directory in the chroot environment or in the final XXX system. (Xxx is the user)

-- With-curses: link Bash to a library, just as the LFS system points it to the static library.

In fact, bash with static links does not have to be linked to libncurses (or temporarily link to static termcap), but it cannot be done in LFS (the LFS method can access related websites, this issue is not in this scope ).

The "&" at the end of each line is very useful. It enables the last command to be executed only when the return value of the previous command is 0 (indicating correct execution. When all commands are copied and pasted, we must ensure that make will not be executed if./configure fails. Similarly, if make fails, make install will not be executed, and so on.

The above method is to build LFS (Linux from scratch directly download from the InternetSource codeOne of the important methods to compile the system and software. In fact, Linux systems include UNIX systems in common with Cmd.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.