Computing.Net > Forums > Linux > Creating a .tar.gz file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Creating a .tar.gz file

Reply to Message Icon

Name: Six
Date: January 17, 2003 at 13:46:15 Pacific
OS: RedHat 8
CPU/Ram: 1.3 512
Comment:

How do I create a .tar.gz file using a terminal? Also, is there anything special I have to do/type to include folders in the tar.gz?

Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Balram Adlakha
Date: January 17, 2003 at 14:01:35 Pacific
Reply:

A tar.gz filed is actually a tarred file which is gzipped...
Let me explain...

What tar does is that it creates one file out of many files/folders. IT DOES NOT COMPRESS.

What gzip does is it compresses a file or folder.

the GNU tar program (available in all distros) has an option -z to pass the file through the gzip algorithm...

So, if you have the following folders you want in your tar.gz file...

foo1 foo2 foo3

you would do something like tar -cvzf myfolders.tar.gz foo1 foo2 foo3

this will create a tar.gz file named 'myfolders.tar.gz' having foo1 foo2 foo3 in it.

If you want better compression, you should use the bzip2 compression instead, using tar -cvjf instead of -cvzf


0

Response Number 2
Name: Balram Adlakha
Date: January 17, 2003 at 14:04:13 Pacific
Reply:

srry, did not explain the options...

c is for creating an archieve, v is for verbose, z is for passing it through gzip, f is for specifying the name of the tar.gz file to be created.


0

Response Number 3
Name: Dave Saxton
Date: January 17, 2003 at 14:07:21 Pacific
Reply:

Type 'tar czf archive.tar.gz folder1 file2 file3 folder4 etc' - nothing else is required, assuming you have gzip and tar installed.


0

Response Number 4
Name: Trip
Date: January 17, 2003 at 14:33:06 Pacific
Reply:

Make sure to add in 'p' with the options to preserve permissions, if that is important to you.

The way I use tar is this:

cd /path/to/dir
tar cCjpf /path/to/dir filename.tar.bz2 *

This uses bzip2 compression to compress everything in the directory. This is the command I use when I make backup images of my system.


0

Response Number 5
Name: Six
Date: January 18, 2003 at 07:27:14 Pacific
Reply:

Awesome, worked, thanks a bunch.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

PPP0 / Gnome in RH 8.0 Cannot boot after ghostin...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Creating a .tar.gz file

OPENING a .tar.gz file on redhat www.computing.net/answers/linux/opening-a-targz-file-on-redhat/12811.html

install a tar gz www.computing.net/answers/linux/install-a-tar-gz/24878.html

what do i need to uncompress a tar.gz www.computing.net/answers/linux/what-do-i-need-to-uncompress-a-targz/10907.html