1829598 Members
1578 Online
109992 Solutions
New Discussion

file tar/gzip

 

file tar/gzip

I would like to know How do I " tar/gzip" a file.
no personal quote
9 REPLIES 9
MANOJ SRIVASTAVA
Honored Contributor

Re: file tar/gzip

Hi Raghu


To know that genrally

1. tar file will ahve a *.tar suffix or you can just do a tar tvf filenname and it will list the contents if that file

2. A gzip file will have .gz suffix , do a gzip -t to check the inegrity of the file and hence the format.


Manoj Srivastava
Jeff Schussele
Honored Contributor

Re: file tar/gzip

Hi Raghuram,

First tar up the files

tar cvf filename.tar /path/to/files/*
or
tar cvf filename.tar ./*

THEN

gzip the tar file

gzip filename.tar

This should result in filename.tgz

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven Sim Kok Leong
Honored Contributor

Re: file tar/gzip

Hi,

In brief,

man tar for more information
man gzip for more information

tar cvf FILE.tar -> compress
tar xvf FILE.tar -> extract
tar tvf FILE.tar -> view

gzip FILE -> compress
gunzip FILE.gz -> uncompress

Hope this helps. Regards.

Steven Sim kok Leong
Paula J Frazer-Campbell
Honored Contributor

Re: file tar/gzip

Hi

Man tar and man gzip should help.

basic command:-

tar -cvf file.tar

gzip -9 file.tar


will cteate a file file.tar.gz (Zipped and tared.


Paula
If you can spell SysAdmin then you is one - anon
S.K. Chan
Honored Contributor

Re: file tar/gzip

Step by step .. (example to tar and gzip my home directory /home/skchan)

# cd /home
# tar -cvf myhome.tar skchan
# gzip myhome.tar

You should get the file "myhome.tar.gz". To unzip ..

# gunzip myhome.tar.gz
# tar -xvf myhome.tar
H.Merijn Brand (procura
Honored Contributor

Re: file tar/gzip

Remove tar, install GNU tar. You'll never regret it

# tar -cvzf filte.tar.gz files
Enjoy, Have FUN! H.Merijn
Sanjay_6
Honored Contributor

Re: file tar/gzip

Hi,

To tar the contents of a directory ,

tar cvf /tmp/new_file.tar /dir1 /dir2 /dir3
To gzip this tar file,

gzip /tmp/new_file.tar

To back out,

gunzip /tmp/new_file.tar.gz
tar xvf /tmp/new_file.tar

Remeber since the files were backed up using absolute path names, extraction of the same will overwrite the file that already exists.

Hope this helps.

Regds
Rory R Hammond
Trusted Contributor

Re: file tar/gzip

Example
TAR and gzip /home directory
assuming you have space in /tmp

cd /home
tar cf - * |gzip > /tmp/home.tar.gz

Example:
Restore /home to /home1 directory

cd /home1

gunzip < /tmp/home.tar.gz| tar xf -
There are a 100 ways to do things and 97 of them are right
harry d brown jr
Honored Contributor

Re: file tar/gzip

Gnu's tar:

http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.13.25/

tar -cvf --gzip


live free or die
harry
Live Free or Die