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
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, the download package name is: p7zip_*.*.*_x86_linux_bin.tar.bz2
3) Execute the following command (unzip and install) on Linux:
Tar xjvf p7zip_*.*.*_x86_linux_bin.tar.bz2
CD P7zip_*.*.*
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 commands
2.1 Extracting 7z files
7za X/home/admin/images/afish.7z-r-o/home/admin/images
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)
-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 afish.7z/home/admin/images/afish/*
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
AFISH.7Z is the compressed package name after compression
/home/admin/images/afish/*: 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.
Installation of the compression decompression program under Linux 7z command and the use of 7Z commands