Tar commandTar can create archives for files and directories. The tar user can create files for a specific file (backup file), change files in the file, or add new files to the file. With the tar command, you can package a whole bunch of files and directories into a single file, which is useful for backing up files or
Tar commandTar can create archives for files and directories. The tar user can create files for a specific file (backup file), change files in the file, or add new files to the file. With the tar command, you can package a whole bunch of files and directories into a single file, which is useful for backing up files or
The "preface" is explained in the blog post:This article will introduce through the personal tone of the Linux platform related compression and decompression command related knowledge, in the current time point "May 23, 2017 " under the grasp of the technical level is limited, there may be a lot of knowledge understanding is not deep enough or comprehensive, I hope you point out the problem of common exchange, In the follow-up work and study, if found
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 gzip properties-j: With the bz2 attribute-Z: With the Compress at
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 gzip properties-j: With the bz2 attribute-Z: With the Compress at
/www[Email protected] ~]# tar-zxvf/home/images.tar.gzUnzip to the specified directory[Email protected] ~]# tar-zxvf/home/images.tar.gz-c/specific dirUnpacking to the specified directoryTar xvf filename.tar-c/specific dir-----------------------------------------------------------------------Linux commands-commands for managing files and directories 2007-05-24 17:07Commands for managing files and directoriesS
Reprinted from Http://www.cnblogs.com/qq78292959/archive/2011/07/06/2099427.htmlTar-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 bz
http://www.xuebuyuan.com/175479.htmlTar-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
six: In/home, a new file is backed up in 2005/06/01[Root@linux ~]# tar-n "2005/06/01"-ZCVF home.tar.gz/homeExample seven: I want to back up/home,/etc, but don't/home/dmtsai[Root@linux ~]# tar--exclude/home/dmtsai-zcvf myfile.tar.gz/home/*/etcExample eight: The/etc/is packaged and unpacked directly underneath/TMP without producing a file.[Root@linux ~]# Cd/tmp[Root@linux tmp]#
Tags: shell script periodic commands use quotation marks Roo chmod log file var logSimple little script, big God DetourImplementation steps:1 Writing scripts2 Doing recurring planning tasks1 scripting[Email protected] ~]# vim tar.shScript content:#!/bin/bash#编写备份脚本, the file name contains a date label after the backup, preventing subsequent backups from overwriting the previous backup data#注意将date命令使用反引号扩起来, the inverted quotation marks indicate the implementation of the reference commandTAR-ZCF
First, the tar command introduction:-C: Create a new tar file-T: List contents of a directory in a tar file-X: Extracting files from the tar file-F: Specifies the archive or tape (or possibly floppy) device (usually selected)-V: Displays the details of the packaged file, V i
1. Introduction
The tar command is a reliable method of backing up files in a unix/linux system and can work almost anywhere, with permissions that are generally available to all users.
2, the use of methods
tar [main options + auxiliary options] File or directory
When using this command, the main option is required,
tar command1. Function Tar command is unix/A reliable way to back up files in a Linux system can work in almost any environment, and its use rights are for all users. 2. Format tar [main option + Secondary options] File or directory Eg:tar zxvf libiconv-1.13. tar.gz./libiconv Tar
First, the basic format of the Tar Packaging command is introduced, and the following three types cannot be confused.tar [-j|-z] [CV] [-f new filename] file1 file2 ...;tar [-j|-z] [TV] [-F new file name]; tar [-j|-z] [XV] [-F new file name] [-C directory]; Parameter description:-C: Create a new package file with-V to s
The tar command is used to package files for compression or decompression
Format: tar [option-c specifies the directory to extract] [file]
To package and compress files:
TAR-ZCVF compressed package name. tar.gz file name
Unzip and expand the ZIP package
T
First, IntroductionThe tar command is used to package one or more files and directories. Compress and decompress files. Tar itself does not have the compression function, is called the compression function implementation.Ii. Methods of UseSyntax: tar [options] [file] option:-C Create new compressed file-D record file d
[[emailprotected] ~]#
In this way, the jpg suffix files are excluded, including sub-directories!If multiple suffix types need to be excluded can be added later, unlimited
1234567
[[emailprotected] ~]# tar -cvf test.tgz test/ --exclude *.txt --exclude *.jpgtest/test/dir2/test/b.logtest/dir1/test/a.log[[emailprotected] ~]#
The above is a match to exclude a file type suffix, or you can specify the file name directl
function: Backup files;Tar cvf backup files. Tar backup files or directories;Tar czvf backup files. tar.gz backup files or directories;Tar xzvf backup file. tar.gz backup file or directory-C extracted to the directory;C: (Create) Create a new backup file;V: (verbose) shows the execution process of the instruction;F: (f
Package Command:TAR-CVF package file name source file name-C Packaging-V Display procedure-f Specifies the file name after packagingExample: TAR-CVF Longls.tar LonglsUnpacking command:TAR-XVF Package file name-X Unpack the packageCompress into. tar.gz formatTAR-ZCVF compressed package. tar.gz Name source file name-Z compress into. tar.gz formatNote: Package compression can be done across files or directoriesExample:
TAR-CVF Shijiazhuang.tar Shijiazhuang Package The Shijiazhuang directory as a Shijiazhuang.tar file and display details of the packaging process (package only)Gzip Shijiazhuang.tar compress Shijiazhuang.tar files (compression only)TAR-CZF shijiazhuang.tar.gz Shijiazhuang Packaging and compressing Shijiazhuang directories, generating shijiazhuang.tar.gz files (packaged and compressed)
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.