Here is how to use GNU Tar to create tarballs and extract files in command line:
To create tarball use: c switch (create), f switch (file), j switch (for bzip2 files .bz2) and z switch (for gnu zip files .gz)
Here are some examples on creating tar, gz and bz2 files:
To create tar file:
$ tar cf file.tar file
To create .gz file:
$ tar czf file.tar.gz file
To create bz2 file:
$ tar cjf file.tar.bz2 file
To extract files use: x switch (extract), f switch (file), j switch (for bzip2 files .bz2) and z switch (for gnu zip files .gz), optional is v switch (verbose - will show output during extraction) or vv (very verbose - will show detailed output during extraction)
Now some examples on how to extract tar, gz and bz2 files:
To extract gz file use:
$ tar xzf file.tar.gz
To extract bz2 file use:
$ tar xjf file.tar.bz2
Funny thing is, that nowdays all three types of files can be extracted quick just by typing:
$ tar xf file.tar
$ tar xjf file.tar.bz2
$ tar xzf file.tar.gz
Verbose output during extraction:
$ tar xvjf file.tar.bz2
file
$
Very verbose output:
$ tar xvvjf file.tar.bz2
-rw-r--r-- baban/baban 5 2009-09-24 15:00 file
$
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment