The 1.tar command (Tape Archive command) file extension includes. tar.gz. tar.bz2 Z for gzip J for bZIP
2. Unzip the archive file TAR-XVZF. tar.gz tar-xvjf. tar.bz2
3. Extract the files to a specified directory tar-xvzf. Tar.gz-c/opt/folder Note: If the directory is to exist, the error will be
4. Remove individual files tar-xz-f. tar.gz "./new/cde.txt" "./new/c.txt" or tar-xz-f. tar.gz--wildcards "*/c.txt"
5. List the contents of the archive file tar-tz-f. tar.gz tar-tz-f. tar.gz | grep abc.txt tar-tz-f. tar.gz | Less abc.txt
6. Archive does not compress TAR-CVF Abc.tar./new
7. Archive and Compress Tar-cvzf abc.tar.gz./new
8. Before adding a file confirm that the file is added to the archive only when the user enters Y tar-czw-f a.tar.gz./new/*
9. To add files to a normal archive file, the file cannot be added to the archive that has been compressed. R tar-rv-f Abc.tar Abc.txt
10. Add the file to the compressed archive (tar.gz tar.bz2) unzip the archive file to add the file to the archive and re-compress gunzip a.tar.gz tar-rf a.tar./path/to/file gzip A.tar use bzip2 and bunzip2 for bzip files respectively
11. Backup by Tar for fixed-time backup directory The TAR command can be implemented by cron scheduling to implement such a backup tar-cvz-f archive-$ (date +%y%m%d). tar.gz./new/
Using Cron to run the above command will keep a backup file similar to the following name: ' Archive-20150218.tar.gz '.
12. Validate when creating an archive W can be used to verify only non-compressed archive files after creating an archive file
Reference documents:
Https://linux.cn/article-5167-1.html
The use and learning of TAR commands