The Linux tar command


The Linux tar command


The following is only my work, the learning process into contact with the contents of deficiencies like him to bear.

tar is an archiving tool under Linux frequently used files or directories to package archive, the archive to a file, but does not compress.
If you need to compress the file, add the -z parameter, it will automatically call gzip command after the package is completed, the compressed tar archive.

parameter

-c or --create create a new backup file
-x or --extract --get or restore files from the backup file
-z or --gzip or --ungzip call gzip command compress / decompress files in the packaging process
- v or --verbose display the name of each archive file
-f or --file specifies the backup file

compression

method one:

tar czvf newFileName.tar.gz fileName / dirName
step, direct tied .tar.gz package.

Method Two:

tar cvf
Step labeled tar package
tar cvf newFileName.tar fileName / dirName
Step gz labeled packet, the first step labeled tar package will be replaced gz package, i.e., after executing the gzip source file will be deleted , after leaving only the compressed file
gzip -v newFileName.tar

Decompression

method one:

Directly .tar.gz package to extract
tar xzvf fileName.tar.gz

Method Two:

tar xvf fileName.tar.gz

Method three:

gzip -d fileName.tar.gz
first .tar.gz tar package file to extract the
tar xvf fileName.tar.gz
then extract it tar packets


reference

Guess you like

Origin www.cnblogs.com/hai-feng/p/12369726.html