Function Description:

A tool used to create and restore backup files, which can be added to and unscrambled from backup filesCopy the code

Parameters:

-c Create compressed files -x Decompress files -t View contents -r Append files to the end of compressed archive files -u Update files in the original compressed package These five commands are independent commands. One of these commands is used for compression and decompression. You can use only one of these commands together with other commands. -z with the gzip attribute -j with the bz2 attribute -z with the compress attribute -v Displays all procedures -o Unzip the file to standard output the following parameter -f is required: Use the file name. Remember, this parameter is the last parameter and can only be followed by the file nameCopy the code

For example:

Tar -cf all.tar *. JPG This command is used to pack all. JPG files into a package named all.tar. -f Specifies the file name of the package. Tar -rf all.tar *. GIF This command adds all. Tar -uf all.tar logo. GIF This command is used to update the logo. GIF file in the original tar package all.tar. -u This command is used to list all files in the all.tar package. Tar -xf all.tar This command is used to unpack all files in the all.tar packageCopy the code

Compression:

JPG: tar -- CVF jpg.tar *.jpg // Package all JPG files in the directory as jpg.tar and compress them with gzip. Gz tar -- CJF jpg.tar.bz2 *.jpg // Pack all JPG files in the directory into jpg.tar and compress them with bzip2 to generate a bzip2 compressed package. Bz2 tar -- cZf jpg.tar.Z *.jpg // Package all JPG files in the directory into jpg.tar and compress them with umCOMPRESS. Z rar a jpg.rar *.jpg // Rar for Linux zip jpg.zip *.jpg //zip for LinuxCopy the code

Extract:

Gz // Decompress tar. Gz tar -xjvf file.tar.bz2 // Decompress tar Tar.Z unrar e file.rar // Unzip file.zip // Decompress the zip fileCopy the code

Conclusion:

Gz using gzip -d or gunzip. 3. *.tar.gz and *. TGZ using tar -xzf. 4 Bz2 was decompressed using tar -xjf. 6. *.Z was decompressed using uncompress. 7Copy the code