use of the tar tool
Packaging:
- Description: after mastering the tar Tools on Linux, you can take care of most of the compressed files on Linux, although Tar is just a packaging tool, but it also supports compression tools such as 7Z,GZIP,XZ,BZIP2. This shoe compression tool itself can only compress files or directories, and does not implement package compression for files. and the tar decompression and compression is the same command, but the parameters are different, but also convenient memory.
- Vim Li///Create a file, write something in it
- TAR-CF Li.tar li///to package Li,-c to create a tar package;-F to specify the name of the file to be created, the file name must be immediately behind F
- Du-h li.tar/du-h li///can find two file sizes almost identical, because there is no compression now just packaging
- mkdir pizi,tar-xf li.tar-c pizi///-x means unpacking;-C means specifying to the development directory
- TAR-CPHF Li.tar li///-p means to use tar packaging to preserve the properties of a file while another host is restored;-H indicates that the backup link points to the source file instead of the link itself.
Compression:
- Summary: To create a file of different compressed format, for the tar is to change a parameter, then the gzip created *.tar.gz file as an example to illustrate.
- TAR-CZF li.tar.gz li///simply add a Z parameter on the package basis to compress the file using gzip
- Tar-xzf li.tar.gz///Extract Files
- Appendix Other compression tools parameters for compressing or extracting files
Compress file format parameters
*.tar.gz - z
*.tar.xz-j
*.tar.bz2-j
@ Leather likes to play basketball
Use of the Tar tool under Linux