7 zip of the compression and decompression software in linux (if rar is not decompressed, let's take a look)

Source: Internet
Author: User
In linux, the compression and decompression software 7zip (the rar will not be decompressed for a moment) -- Linux general technology-Linux technology and application information. The following is a detailed description. [I = s] This post was last edited by pl_014

Note: Anyone who only wants to know how to extract the RAR format can directly jump to the back, but be sure to install the 7zip rar Module
In addition, you can install unrar in linux to decompress the rarfile.
Introduction
7-zip is a cross-platform open source compression/decompression software, the official website is http://www.7-zip.org, support 7z, ZIP, GZIP, BZIP2, TAR and other formats, and can decompress the rarfile (note: due to the Protocol relationship, it cannot be compressed into RAR format at the moment), and the function and compression ratio can be comparable to winRAR. There is hope that the rarfile cannot be decompressed in linux.

About 7z format
Similar to the RAR format, the 7z format is a compression format that supports different compression rates. The highest level of compression ratio is higher than the RAR format (that is, the size of the compressed file, smaller than RAR format), of course, the higher the compression level, the more time it takes to compress/decompress, the occupied memory is higher (or even exceeds the size of the memory that can be allocated to 7zip, please note). The minimum compression level is 0, which is only for packaging.

Install
In debian/ubuntu, you can find the Software Package Manager or software center and search for "7z". You can see a package with the words p7zip and install it. Users who need to support the RAR format also need to install the 7zip rar ModuleAfter installation, you can use it.
You can use the apt-get install p7zip-full in the command line (ubuntu users can add sudo directly in front, debian users may need to switch to the root user first)
Fedora is similar to debian/ubuntu.
Opensuse users please open the official soft site, the address is http://software.opensuse.org, enter "7zip" in the search box, and select your version, search, usually is the first installation.
Users of other releases can either find from their own sources or.
For windows users, go to http://www.7-zip.org/download.html to find the download file. The installation process is simple.

7-how to use zip in the command line
Format: 7z [adeltux] [-] [SWITCH]...
The first 7z is the program name. After 7zip is installed, there will be three programs: 7z, 7za, and 7zr. Among them, 7z is fully functional (that is, enabling the functions of all modules ), 7za only uses 7zip and does not enable other modules (in this case, rar and other formats are not supported). 7zr is lite and only supports 7z format.
The second parameter [adeltux] is used to tell 7zip what function to execute: A is used to create a compressed file or add a file to the compressed file.; D. Used to delete a file from a compressed file.E is used for decompression, but does not create a directory structure; l is used to display the content contained in the compressed file; t is used to test whether the compressed file is valid; u is used to update the files in the compressed file; X is used to extract and create a directory structure..
[-] [SWITCH] is an option SWITCH. Some options will be introduced later. You can also use the command man 7z to view detailed instructions.
Is the name of the compressed file, followed by the name of the input file (you can use wildcards, You can have multiple files ).
Commonly used option Switches
-T: Specifies the compression format, such as-t7z.
-M: sets the compression method. For details, see [url = file: /// usr/share/doc/p7zip-full/DOCS/MANUAL/switches/method.htm]/usr/share/doc/p7zip-full/DOCS/MANUAL/switches/method.htm [/url] (in debian, if it cannot be opened, refer to your man page)
-P: set a password for the compressed file. You can add-p to the input command during compression, enter the password during execution, or directly-pPASSWORD, such as-p123456.
-Mhe = on | off: Applicable only to the 7z format. enable or disable file list encryption. The default value is off.
-Si: reads data from standard input. It is often used in combination with MPs queue operations to compress/package files.
-So: writes data to the standard output, which is often combined with MPs queue operations to decompress Or release files.
-V: used for volume compression. For example, if the maximum size of each output file is 1 MB,-v1m
-O: store the extracted files in the specified directory. to output the extracted files to directory a, use-oa
-L: stores the file/directory corresponding to the symbolic link and replaces it with this link (note that recursive links cannot be found in the compressed file)
Command return values
7-after the zip file is exited, it also has its own return value, To view the return value, run echo $? immediately after the command is executed? Command(Do not execute other commands in the middle) to view the return values. The meanings of each return value are listed below.
0 normal
1 warning (no error). For example, some files cannot be read during compression.
2 error
7. Unable to identify command line parameters
8. Insufficient memory for operations
255 press Ctrl + C to stop the program

7-zip instance used in command line
Note: Unless otherwise specified, all operations are performed under normal users.
1. Basic operations
Compression
I saved some files used in the experiment ~ /Temp, the structure is as follows:

Contains three files and two directories, one of which is hidden? The freemind directory contains two subdirectories, one of which is hidden? .
Okay. We will compress these files and execute them in the command line.
CODE: 7z a temp.7z *
Related Article

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.