LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-06-2004, 10:55 PM   #1
tcma
Member
 
Registered: Aug 2004
Distribution: gentoo, Fedora Core
Posts: 54

Rep: Reputation: 15
gzip a directory into a file


How to gzip a directory into a file? I get a directory error when gzip found that the directory is a directory, not a file.

I googled for an hour but still don't get the answer.
 
Old 10-06-2004, 11:04 PM   #2
BrianW
Member
 
Registered: Jul 2003
Location: Montana
Posts: 297

Rep: Reputation: Disabled
I always use tar and then gzip it.

tar -cf filename.tar <files to compress here>

can haver several dirs and single files.
 
Old 10-06-2004, 11:08 PM   #3
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
easy, use tar (the "z" option passes it through gzip):

tar czvf tarfilename.tar.gz /directory/to/compress


then to untar/uncompress just do a :

tar zxvf tarfilename.tar.gz


tar itself won't "compress" it, just puts all the files/directories into one big file. Then you got to pass it through gzip manually or use the "z" option. You can also use "j" insead of "z" for bzip2

Last edited by 95se; 10-06-2004 at 11:09 PM.
 
Old 10-07-2004, 02:46 AM   #4
tomByrer
LQ Newbie
 
Registered: Oct 2004
Location: USA, CO, Denver
Posts: 8

Rep: Reputation: 0
Quote:
Originally posted by 95se Then you got to pass it through gzip manually or use the "z" option. You can also use "j" insead of "z" for bzip2 [/B]
I think bzip2 is considered better (smaller) compression, so I'd say use that.
 
Old 10-07-2004, 02:51 AM   #5
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Except bzip2 is significantly slower than gzip.

bzip2 gives smaller files, but gzip is faster, so I would try both and see which one suits you the best.

--Ian
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tar and gzip - how do i point to a output directory RedHat123 Linux - Newbie 4 04-20-2011 10:48 AM
script to gzip all directories in a directory br8kwall Programming 11 09-06-2005 10:42 PM
untar gzip file problem jmr0311 Linux - General 8 09-12-2004 04:32 PM
linux gzip file by date antonioxcom Linux - Newbie 4 07-12-2004 12:07 AM
How to gzip a file SnowSurfAir Linux - Software 5 07-31-2003 01:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration