1. Compress and Decompress commandsCommon compression formats:. zip,. gz,. bz2,. tar.gz,. tar.bz2,. rar. zip format compression and decompression commandsZip compressed file name source files: Compressed filesZip-r compressed file name Source directory: Compressed directoryUnzip compressed file name: Unzip. zip files. gz format Compression and decompressionGzip source files: Compressed files in. gz format, source files disappearGzip-c source Files > Compressed files: Compressed to. gz format, so
Example of the syntax for using the tar command in linux, linuxtar
Syntax: tar [primary option + secondary option] file or directory
When you use this command, the main option is required, and it tells tar what to do. The auxiliary option is used for assistance and can be us
Decompression syntax: tar [main option + Secondary options] file or directoryWhen using this command, the main option is required, and it tells Tar what to do, auxiliary options are auxiliary and can be used.Main options:C Create a new profile. Select this option if the user wants to back up a directory or some files. Equivalent to packaging.X release the file fr
fails--totalsDisplays the total number of bytes written with the--create parameter-V,--verboseDetailed display of processed files-V,--label NAMEAssign a volume label to an archive--versionDisplays the version number of the TAR program-W,--Interactive,--ConfirmationEach operation requires confirmation-W,--VerifyVerify after writing to archive--exclude FILEDo not include the specified file-X,--exclude-from FILEReads a list of files that you do not want
Unix| solution at present, Unix operating system in China's financial sector is widely used, UNIX with its powerful functions (time-sharing, multitasking, multi-user, network interconnection, graphics interface, etc.), much favored by financial enterprises. Agricultural Bank of China is currently applying the SCO UNIX openserver50 is more powerful.
The bank's savings, accounting, credit cards and other computer business processing systems are running on the UNIX operating system platform. The d
home.tar.gz/homeExample seven: I want to back up/home, etc, but don't/home/dmtsai[Email protected] ~]# tar--EXCLUDE/HOME/DMTSAI-ZCVF myfile.tar.gz/home/*/etcExample eight: Unpack the/etc/directly under/TMP without generating files![Email protected] ~]# cd/tmp[Email protected] tmp]# TAR-CVF-etc | TAR-XVF-# This action is a bit like cp-r/etc/tmp ~ still has its us
Tar commandCan be used to compress packaged single files, multiple files, a single directory, multiple directories.Linux Packaging Command _tarThe tar command can be used to compress a packaged single file, multiple files, a single directory, and multiple directories.Common formats:Single file compression package
information of each compressed file in Example 1 and does not understand the pressure.
$ gzip-l *
Compressed UNCOMPR. Ratio Uncompressed_name
277 445 43.1% Mm.txt
278 445 43.1% Sort.txt
277 445 43.1% Xx.com
$ ls
mm.txt.gz sort.txt.gz xx.com.gz
Example 4: Compress a tar backup file, such as Usr.tar, at which time the compressed file extension is. tar.gz
$ gzip Usr.tar
$ ls
Usr.tar.gz
Unzip
Summarize the commonly used tar decompression commands as a memo:Tar-C: Create compressed archives-X: Unzip-T: View content-r: Append files to the end of a compressed archive file-U: Update files in original compressed packageThese five are stand-alone commands, which use one of the compression decompression, and can be used with other commands but only one. The following parameters are optional when compressing or extracting files as needed.-Z: With
Linux packaging command-tar in windows, there are a lot of compression software, such as winrar, winzip, etc., You can package a folder. In Linux, there are two main compression commands: gzip and bzip2. the latter has a high level of compression. Players familiar with these two commands know that they can only compress one file or file at a time. The folder or d
important, especially if you want to preserve the properties of the original file! Tar example six: In/home, a new file is backed up in 2005/06/01[Root@linux ~]# tar-n ' 2005/06/01′-ZCVF home.tar.gz/homeTar example seven: I want to back up/home,/etc, but don't/home/dmtsai[Root@linux ~]# TAR–EXCLUDE/HOME/DMTSAI-ZCVF myfile.tar.gz/home/*/etcTar example eight: Unpa
Conversion from: Tar decompression command
Tar
-C: Create a compressed file-X: Extract-T: View content-R: append an object to the end of the compressed archive object-U: update files in the original compressed package
These five are independent commands, one of which must be used for compression and decompression. They can be used with other commands, but only on
-C: Create compressed archives-X: Unzip-T: View content-r: Append files to the end of a compressed archive file-U: Update files in original compressed packageThese five are stand-alone commands, which use one of the compression decompression, and can be used with other commands but only one. The following parameters are optional when compressing or extracting files as needed.-Z: With gzip properties-j: With the bz2 attribute-Z: With the Compress attribute-V: Show All procedures-O: Unpack the fil
Example 1: package all the files in the/etc directory into/tmp/etc.tar[Root @ linux ~] # Tar-cvf/tmp/etc.tar/etc [Root @ linux ~] # Tar-zcvf/tmp/etc.tar.gz/etc [Root @ linux ~] # Tar-jcvf/tmp/etc.tar.bz2/etc # Note that the file name after parameter f is obtained by ourselves. We use. tar for identification.# If the z
TheTar(Tape archive) command bundles a bunch of files together and creates an archive (commonly calledTar fileOrTarball) On a tape, disk drive, or floppy disk. The original files are not deleted after being copied to the TAR file.
Usage:List: tar-TF Extract: tar-XF Create: tar
File compression and decompressionTar commandThe TAR command creates archives for Linux files and directories.With tar, you can create files (backup files) for a specific file, or you can change files in the file or add new files to the file. Tar was originally used to create archives on tape, and now users can create
Tar
-C: Create a compressed file-X: Extract-T: View content-R: append an object to the end of the compressed archive object-U: update files in the original compressed package
These five are independent commands, one of which must be used for compression and decompression. They can be used with other commands, but only one of them can be used. The following parameters are optional when files are compressed or decompressed as needed.
-Z: With the gzip a
Example !!!!!
1.zip a group of files with the suffix tar.gz.# Tar CVF backup.tar/etc# Gzip-Q backup.tarOr# Tar cvfz backup.tar.gz/etc/
2.release a file suffixed with tar.gz.# Gunzip backup.tar.gz# Tar xvf backup.tarOr# Tar xvfz backup.tar.gz
3. Compress With one command#
tar command detailed
-C: Set up compressed files
-X: Decompression
-T: viewing content
-R: Appending files to the end of a compressed archive
-U: Updating files in original compressed package
These five are independent commands, compression decompression to use one of them, can be used with other commands but only one.
The following parameters are optional when compressing or decompressing files as needed.
A detailed description of the tar command under LinuxTar is one of the most commonly used backup tools in a Linux environment. Tar (tap archive) is intended to manipulate tape files, but Linux-based file manipulation mechanisms can also be applied to normal disk files. Tar can be used to create, restore, view, manage f
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.