"Linux_ Notes" linux_ File management commands-compression decompression and archiving basic tools

Source: Internet
Author: User

Learning resources from: www.magedu.com

Mistakes are unavoidable in the learning process, and if found, they are also pointed out by the great gods.

Some of the sample operations are related to historical operations, and if the previous example operation has not been performed, there may be some examples of operations that cannot be performed. Examples are for informational purposes only. (see annex for examples)


File management Commands--compression decompression and archiving basic tools

Compress, unzip command


compression format:GZ, bz2, XZ, zip, Z

Compression algorithm: The algorithm is different, the compression ratio will be different;

Early
Compression:
Compress(compression ratio is small): FILENAME. z--the file name after compression
Extract:
Uncompress

gzip, bzip2, XZ can only file, and the default compression is complete after deleting the source file, zip can compress the directory

gzip:. GZ
Gzip/path/to/somefile: The original file is deleted when the compression is complete
-D: Unzip
-#:1-9, specify the compression ratio, default is 6;

Gunzip: (Uncompressed)
Gunzip/path/to/somefile.gz: The original file will be deleted when the decompression is complete

Zcat/path/to/somefile.gz: To view the contents of a text file without being pressed


bzip2:. bz2
BZIP2 compression tool with a greater compression ratio than gzip, using a format approximation
Bzip2/path/to/somefile
-D: Unzip
-#: 1-9, specify the compression ratio, default is 6;

-K: Keep the original file when compressing

bunzip2/path/to/somefile.bz2--Decompression

Bzcat/path/to/somefile.gz: To view the contents of a text file without being pressed


x z:. XZ
Xz/path/to/somefile
-D
-#: 1-9, specify the compression ratio, default is 6;

-K: Keep the original file when compressing

Unxz
Xzdec: Unzip
Xzcat:

Zip: Both archived and compressed tools
Zip Filename.zip FILE1 FILE2 ...: Do not delete the original file after compression
Unzip Filename.zip Decompression

Archive:Archiving (consolidating multiple files into a single file), the archive itself does not imply compression

Tar: Archive tool,. tar--only archive not compressed
-C: Create an archive file
-F File.tar: Archived file for operation (must have parameters after F)
-X: Expand Archive
--xattrs: Preserve extended attribute information for files (backup) when archiving
-T: Do not expand the archive to directly see which files are archived

-ZCF: Archive and invoke gzip compression
-ZXF: Call gzip to unzip and expand the archive,

-JCF: Archive and call bzip2 compression
-JXF: Call bzip2 to unzip and expand the archive,

-JCF: Archive and call XZ compression-(REDHAT6)
-JXF: Call XZ to unzip and expand the archive,

cpio: Archive tool
File/boot/initr .... Img--gzip
Cp/boot/initr .... Img/root
Cd
Ls
MV Initr .... IMG initr...img.gz--renaming
Ls
Gzip-d initr...img.gz--Extract Files
Ls-lh
File Initrd...img--cpio





This article from "Not Daze" blog, please make sure to keep this source http://tobeys.blog.51cto.com/10620284/1691128

"Linux_ Notes" linux_ File management commands-compression decompression and archiving basic tools

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.