GNU tar creates and manipulates archives which are actually collections of many other files; the program provides users with an organized and systematic method for controlling a large amount of data. The name “tar” originally came from the phrase “Tape ARchive”, but archives need not (and these days, typically do not) reside on tapes.
tar command like all unix utilities has a short and long form for parameters..
I will be writing several posts on this to display simplified tar operations the first one will deal with creating new archives.
Below are the most commonly used tar operations and their parameter names
–create
-c
Create a new tar archive.–list
-t
List the contents of an archive.–extract
-x
Extract the contents of an archive.
Also some common parameters are…
–file
-f
Name of the file–verbose
-v
Verbose output.
This post will cover the creat syntax in a simplified by detailed form.
So on to creating tar archives…
Simple Creation
long form
$ tar –create –file=<filename> <file(s)/directory(s) to add>
example : tar –create –file=foobar.tar foo.bar1 foo.bar2 foo.bar3
short form
$ tar -cf <filename> <file(s)/directory(s) to add>
example : tar -cf foobar.tar foo.bar1 foo.bar2 foo.bar3
With verbose output
long form
$ tar –create –verbose –file=<filename> <file(s)/directory(s) to add>
example: tar –create –verbose –file=foobar.tar foo.bar1 foo.bar2 foo.bar3
short form
$ tar -cvf <filename> <file(s)/directory(s) to add>
example: tar -cvf foobar.tar foo.bar1 foo.bar2 foo.bar3
With verbose and gzip compression (fast compression) output
long form
$ tar –create –verbose –gzip –file=<filename> <file(s)/directory(s) to add>
example: tar –create –verbose –gzip –file=foobar.tar.gz foo.bar1 foo.bar2 foo.bar3
short form
$ tar -cvzf <filename> <file(s)/directory(s) to add>
example: tar -cvzf foobar.tar.gz foo.bar1 foo.bar2 foo.bar3
With verbose and bzip2 compression (high compression) output
long form
$ tar –create –verbose –bzip2 –file=<filename> <file(s)/directory(s) to add>
example: tar –create –verbose –bzip2 –file=foobar.tar.bz2 foo.bar1 foo.bar2 foo.bar3
short form
$ tar -cvjf <filename> <file(s)/directory(s) to add>
example: tar -cvjf foobar.tar.bz2 foo.bar1 foo.bar2 foo.bar3
Comments are closed.