Read about how to extract tar file in linux, The latest news, videos, and discussion topics about how to extract tar file in linux from alibabacloud.com
The tar command not only extracts a package, but also extracts the files that are specified in the software package. Today a friend asked me, I just went to find the information, hehe
root@ubuntu:/tmp# tar-tf json-1.2.1.tgz
package.xml
json-1.2.1/readme json-1.2.1/config.m4
Json-1.2.1/config.w32
json-1.2.1/json.dsp
json-1.2.1/json.c
json-1.2.1/json_parser.c
Json-1.2.1/json_parser.h
json-1.2.1/php
Refer to How to link http://www.linuxdiyf.com/viewarticle.php?id=194348Don't talk nonsense directly on the exampleTAR-XZVF $basePath/apd.tar.gz jar/apd.jar-o > $basePath/apd.jar$basePath/apd.tar.gz files to unzipJar/apd.jar the relative file path within the apd.tar.gz file to be decompressed. How this path gets: TAR-TVF *.tar.gz.-O to decompress standard output>.
People accustomed to tar czvf or tar xzvf may encounter tar.xz also want to use a single command to fix decompression or compression. Not really. The parameters of the XZ format, such as Z, for Gzip,j are directed at bzip2.To create a tar.xz file: Just tar cvf xxx.tar xxx/create xxx.tar files First, then use Xz-z Xxx
1. First look at the files in the compressed document, if you do not know the contents of the file, and then directly decompression, this is not possibleYou can view the contents of a compressed package by using the #tar-tf compressed package name2. Compress a fileTAR-ZXVF zabbix.tar.gz Zabbix-2.4.7/upgrades/dbpatches/2.2/readmeLook at the format is the decompression command, and then add the need to unzip
: Back up all the files in the/etc/and save their permissions![Email protected] ~]# tar-czvpf/tmp/etc.tar.gz/etc# The properties of this-p are important, especially if you want to keep the properties of the original file!Example six: In/home, more than 2005/06/01 new files are backed up[Email protected] ~]# tar-n ' 2005/06/01 '-CZVF home.tar.gz/homeExample seven:
Tar is commonly used on Linux packaging, compression, compression tools, he has a lot of parameters, folding only to enumerate the commonly used compression and decompression parametersParameters:-c:create set up the parameters of compressed archives;-X: Extracting parameters of compressed archives;-Z: Whether to use gzip compression;-V: Files are displayed during compression;-F: The top document name, immediately after F to answer the
Over the years, data compression has been very useful for us. Whether it's a zip file for a picture sent in a message or a compressed data file on a server, we can make it easier or more efficient to save disk space. Some compression formats sometimes allow us to compress files at a ratio of 60% (or even higher). Below I will show you how to use these commands to compress files or directories under Linux. W
Python's self-contained tarfile module makes it easy to read the tar archive, and cow B can handle using GZIP and bz2 to compress archive files tar.gz and tar.bz2.Corresponding to the Tarfile is the ZipFile module, ZipFile is the processing of zip compression. Please note: os.system (cmd) can make the Python script execute commands, including: Tar-czf *.tar.gz *,tar
We often encounter packages packaged in. gz format, which is not an executable automatic installation package, which is equivalent to a ZIP package, which is the process of manually extracting, editing, configuring environment variables. You can compress a GZ file by using the following command:Tar zxvf Parameter description:Z-to filter the gzip file, that is, only the specified GZ format
Parameters:
-c:create to establish the parameters of compressed files;
-X: Unzip the parameters of the compressed file;
-Z: Do you want to use gzip compression;
-V: The process of compressing the display of files;
-F: Top document name, immediately followed by the file name, can not add parameters
For example: One, all the files in the entire/home/www/images directory are packaged as/home/www/images.t
Remove directory structure plus--strip-components N
Such as: Compressed file Eg.tar file information for Src/src/src/eg.txt
Run TAR-XVF Eg.tar--strip-components 1
Result: Src/src/eg.txt
If you run TAR-XVF Eg.tar--strip-components 3
The result of the decompression is: eg.txt
In the decompression, if you want t
This paper mainly from the following several convenient to explain file archiving and compression, while comparing the compression ratios and characteristics of several different compression methods.
File Archive command tar,tar.gz source package installation Management
Create a Tar Package-
gzip unzip files-j Support bzip2 Extract files-Z Support Compress unzip files-V Show Operation procedure-L File System boundary settings-K Keep the original file without overwriting-m reserved files are not overwritten-W confirm the correctness of the compressed fileThe optional parameters are as follows:-B Set Number of blocks-c switch to the specified director
/decompress the file. With this option, the file can be compressed, however, this option must be used for decompression during restoration. Tar common commands:-c: Create a compressed file-x: extract-t: View content-r: append a file
the package in a specific directory.
-P: (lower case p) retains the original permissions and attributes of the backup data. It is usually used to back up important configuration files, which are very important parameters.
-P: (uppercase P) retains the absolute path, allowing the backup data to contain the root directory
-- Exclude = FILE: Do not package the FILE during compression.
Tip:
Today in Aix with TAR-CVF backup, make a tar package, occupy the hard disk space is too large, no compression ratio,
Try to use the TAR-ZCVF Linux system can use the-z command (z with gzip to compress/extract the file, plus this option to compress the archive
directory.
-P: (lower case p) retains the original permissions and attributes of the backup data. It is usually used to back up important configuration files, which are very important parameters.
-P: (uppercase P) retains the absolute path, allowing the backup data to contain the root directory
-- Exclude = FILE: Do not package the FILE during compression.Tip: extract
. rpm/extract Rpm2cpio file.rpm | Cpio-div. Deb/install Dpkg-i File.deb. deb/exrtact Dpkg-deb-fsys-tarfile File.deb | Tar xvf-AR P file.deb data.tar.gz | Tar Xvzf-. zip Unzip File.zip Bzip2-d myfile.tar.bz2 | Tar xvf Tar Xvfz myfile.tar.bz2 X is decompres
Log in 22 after tar compress/var/log directory output to standard input via pipeline to local 22_log.tar.gz file ssh 192.168.0.22 "Cd/var; Tar-zcvf-log"|cat >22_log.tar.gz re-creates the file in a relative location when extracting the archive file. You can use this method to
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.