This article mainly introduces the method of installing 7z command under Linux, and introduces the use of 7z command. 7z compression format has many advantages, with a very high compression ratio, if you do not understand, see the article: 7z format, LZMA compression algorithm and 7-zip detailed introduction.
The Linux distribution used by Reille is Ubuntu and has been validated on Redhat for normal use.
1. Linux Installation 7z command
There are two ways to install 7z commands on Linux: Install online and install packages, as described below.
1.1 Online Installation
If your host Linux can be connected to the extranet, it is recommended this way, convenient and simple, execute the command:
sudo apt-get install P7zip
You can install the 7z command online.
1.2 Installation package Installation
7z (exactly 7-zip) provides a program installation package under the line, or it can be compiled and installed on its own. This is the installation using the bin package provided by 7z.
Host Linux is generally X86, and 7z provides a compiled bin package that can be easily installed. The steps are as follows:
1) go to the website http://sourceforge.net/projects/p7zip/files/or http://sourceforge.net/projects/p7zip/files/p7zip/download P7zip package , the current latest version is 9.20.1;
2) Find the corresponding version number in, the page will provide two for you to download, one is the bin package, the other is the source package, here is the bin package, to 9.20.1 as an example, the download package name is: p7zip_9.20.1_x86_linux_bin.tar.bz2;
3) Execute the following command (unzip and install) on Linux:
Tar xjvf p7zip_9.20.1_x86_linux_bin.tar.bz2
CD p7zip_9.20.1
SH install.sh
Note that the above command permissions require root privileges, so it is best to add sudo to the tar and SH commands.
By this, the installation is complete.
2. Use of 7Z commands2.1 Extracting 7z files
7za x phpmyadmin-3.3.8.1-all-languages.7z-r-o./
Parameter meaning:
x represents the extracted file and is extracted by the original directory tree (and also the parameter e is the extracted file, but it will extract all the files to the root, not their original folder)
phpmyadmin-3.3.8.1-all-languages.7z is a compressed file, here I use Phpadmin to do the test. The phpmyadmin-3.3.8.1-all-languages.7z in the current directory is used here by default
-R means recursive decompression of all subfolders
-O is the specified directory to extract to,after-O is no space, direct access to the directory. This is a point to note.
2.2 Compressed Files/folders
7za A-t7z-r mytest.7z/opt/phpmyadmin-3.3.8.1-all-languages/*
Parameter meaning:
A for adding files/folders to a compressed package
-T is the specified compression type, which is set to 7z, not specified, because the 7za default compression type is 7z.
-R means that all subfolders are recursively owned
MYTEST.7Z is the compressed package name after compression
/opt/phpmyadmin-3.3.8.1-all-languages/*: is the compression target.
Note: 7za does not only support. 7z compression format, it also supports compression types such as. tar.bz2. As described above, specify with-T.
Turn http://www.cnblogs.com/mchina/archive/2013/03/08/2934473.html
Use of 7z commands and 7z commands installed under Linux