标签:des style code tar ext color
tar -czvf myarchive.tgz mydirectory/
We use the -t option to create an linux tar archive
Note that .tgz is the same thing as .tar.gz
tar -cvf myarchive.tar mydirectory/
tar -cvfj myarchive.tar.bz2 mydirectory/
Note:To create highly compressed tar file we use option as j.
Extract linux tar gz (Gzip) archive
tar
-xzvf mystuff.tgz
To untar or extract a tar file, just issue following command using option x (extract).
Extract linux simple tar archive
tar -xvf mystuff.tar
Exterct linux simple tar.bz2 archive
tar -jxvf mystuff.tar.bx2
Extract linux tar archive to speciefied directory
tar
-xvzf filename.tar.gz -C /desired/path
And now let us shortly explain this command
Usage: tar [OPTION]… [FILE]…
Let us check the option used in this example
-c,
–create create
a new archive
-z, –gzip,
–ungzip filter the archive
through gzip
-v,
–verbose verbosely
list files processed
-f,
–file=ARCHIVE use
archive file or device ARCHIVE
-C directory file
Performs a chdir operation on directory and
performs the c (create) or r (replace) operation on file .
In c and r mode,
this changes the directory before adding the following files. In x mode, change
directories after opening the archive but before extracting entries from the
archive.
tar -tvf myarchive.tar
tar -tzvf myarchive.tgz
Here we used the – t opton
-t,
–list
list the contents of an archive
————————————————-
Go ahead, try out these commands and stay tuned; we will come up with more doccumentation on linux tar command
The article source: http://linuxbasiccommands.wordpress.com/2008/04/04/linux-tar-command/
标签:des style code tar ext color
原文地址:http://www.cnblogs.com/cnguoyu123/p/3704549.html