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 cxvf libiconv-1.13. tar.gz./*. PHP 3. Main parameters when using this command, the main option is required, and it tells Tar what to do, auxiliary options are auxiliary and can be used. 3.1 Main option:-C creates a new profile. Select this option if the user wants to back up a directory or some files. -R appends the file to be archived to the end of the archive file. For example, the user is ready to backup files, and found that there is a directory or some files forgot to back up, you can use this option to append the forgotten directories or files to the backup file. -T lists the contents of the archive to see which files have been backed up. -U update file. That is, replace the original backup file with the new file, if the file you want to update is not found in the backup file, append it to the end of the backup file. -X releases the file from the archive file. 3.2 Auxiliary Options:-B This option is set for the tape drive, followed by a number, to indicate the size of the chunk, and the system preset value is 20x512 bytes. -F using a profile or device, this option is usually required. -K saves the file that already exists. For example, restoring a file, encountering the same file during the restore process, does not overwrite it. -M when restoring files, set the modification time of all files to now. -M creates multiple volumes of files for storage on several disks. -V Details the file information processed by tar. Without this option, TAR does not report file information. -W each step requires confirmation. -Z Compress/unzip the file with gzip, plus this option to compress the archive file, but you must also use this option to decompress when restoring. For example: 1. Package and compress all. txt files in the current directory to file this.tar.gz, we can use tar czvf this.tar.gz./*.txt 2. Extract the files from the this.tar.gz in the current directory to the current directory we can use Tar xzvf this.tar.gz./
Linux Tar Command parameters