: 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: I want to back up/home, etc, but don't/home/
1, first of all, we first say why there are three formats:(1) RAR format: RAR format is the first compression method, it is mainly used for the compression of some files of commercial organizations, it can be based on the requirements of different companies, to set up different compression algorithms, this algorithm is not public, security is relatively high, but he is charged.(2) Zip format: Because of the RAR format charges, will inevitably be born some free compression format, then zip is bor
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.tar to compress Xxx.tar into XXX.TAR.XZExtra
format I have used. It does not take up too much CPU when compressing, and it can get a very ideal compression rate. Use the following format to compress a directory:# TAR-ZCVF archive_name.tar.gz directory_to_compressUnzip:# TAR-ZXVF Archive_name.tar.gzThis unpacking command will unlock the document under the current directory. Of course, you can also use this command to squeeze the path of the unpacking:
format I have used. It does not take up too much CPU when compressing, and it can get a very ideal compression rate. Use the following format to compress a directory:# TAR-ZCVF archive_name.tar.gz directory_to_compressUnzip:# TAR-ZXVF Archive_name.tar.gzThis unpacking command will unlock the document under the current directory. Of course, you can also use this command to squeeze the path of the unpacking:
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 file name, can
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 to specify the extract directory, you can add
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
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
of the unpacking:# TAR-XVF Archive_name.tar-c/tmp/extract_here/TAR. GZThis format is the most compressed format I have used. It does not take up too much CPU when compressing, and it can get a very ideal compression rate. Use the following format to compress a directory:# TAR-ZCVF archive_name.tar.gz directory_to_compressUnzip:#
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 file can be decompressed.X-Unzip (tar can also be compressed to
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 the file path, you can.3. Unzip a specified f
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.tar
[root@xoaocom ~]# tar-cvf/home/www/images
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>./lib-lib64-include/jars/apd.jar redirect output to a fileOther articles that can be consul
Using Python's Hashlib module to extract MD5, online reference, think this is good, can be used as a module directly.#-*-coding:utf-8-*-import hashlib import sys import osdef md5hex (word): "" MD5 encryption algorithm, return 32-bit lowercase 16 binary symbol "" " If Isinstance (Word, Unicode): Word = Word.encode ("Utf-8") Elif not isinstance (Word, str): Word =
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.