LinuxQuestions.org
Review your favorite Linux distribution.
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 06-16-2007, 04:09 PM   #1
BajaNick
Senior Member
 
Registered: Jul 2003
Location: So. Cal.
Distribution: Slack 11
Posts: 1,737

Rep: Reputation: 46
tar is not compressing archive file


I am trying to simply compress a directory using

tar -zcvf test.tar.gz /home/me/dir1

It creates the archive but it is the same exact size as the original directory, same thing when I try using zip -r archivefile1 .

What am I doing wrong?
 
Old 06-16-2007, 04:24 PM   #2
shuuhen
Member
 
Registered: Jun 2004
Distribution: Mac OS X 10.6.6, Gentoo Linux, FreeBSD 6.0
Posts: 127

Rep: Reputation: 20
What types of files are you trying to compress? You won't get much out of compressing a directory of MP3s, since the it's a compressed format. Text files and files of non-compressed formats should compress significantly.
 
Old 06-16-2007, 05:07 PM   #3
BajaNick
Senior Member
 
Registered: Jul 2003
Location: So. Cal.
Distribution: Slack 11
Posts: 1,737

Original Poster
Rep: Reputation: 46
Some pics and text files. They are not compressing at all. I check the file size of the original directory and its exactly the same as the one that is supposed to be compressed, its like the switch to compress is not working.
Ive read half a dozen websites that show the exact same way I am doing it.
 
Old 06-16-2007, 05:22 PM   #4
shuuhen
Member
 
Registered: Jun 2004
Distribution: Mac OS X 10.6.6, Gentoo Linux, FreeBSD 6.0
Posts: 127

Rep: Reputation: 20
I'd expect the text files to compress, but the pictures may or may not depending on their format. I know that JPEG, GIF and PNG are compressed formats, but I don't remember any of the uncompressed ones. TIFF uses a lossless compression algorithm, so it might compress a little but I'm not sure.

As a test, you could copy all of the text files to a separate directory to test if they compress.
 
Old 06-16-2007, 05:47 PM   #5
BajaNick
Senior Member
 
Registered: Jul 2003
Location: So. Cal.
Distribution: Slack 11
Posts: 1,737

Original Poster
Rep: Reputation: 46
Yea, ive been doing all kinds of tests like that. Thanks.
 
Old 06-16-2007, 11:21 PM   #6
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 48
Thoughts:

A) You don't need the dash when invoking tar:

tar zcvf test.tar.gz /home/me/dir1

is sufficient. I don't think that the dash will do any harm, but try without, and see if that makes a difference; it might be affecting the z option, which does the compression. I can't replicate the problem even when I do use the dash.

B) Try 'file test.tar.gz'. If you get

Code:
> file test.tar.gz
test.tar.gz: gzip compressed data, from Unix
Then you know that the file is in fact tarred and gzipped.

C) If you want to bring out the hammer and tongs, you might try

Code:
tar cvf - /home/me/dir1 | gzip -9c > test.tar.gz
D) I believe that gzip does not compress when the file size of the compressed file is equal to or greater than the original file. This usually only happens on files which have already been compressed, and would be very unusual on uncompressed text files (typical compression on text files is around %90)

E) What happens when you use "tar Zcvf test.tar.bz2 /home/me/dir1" ?
 
  


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
file = posix tar archive JsCAMRY Linux - Hardware 1 01-26-2007 09:41 AM
Restore a single file from tar archive lucktsm Linux - General 2 12-03-2006 01:57 PM
TAR Archive file - need relative path cmd0a0 Linux - Software 2 10-19-2005 02:57 PM
Tar gives error when creating a tar file archive davidas Linux - Newbie 10 04-13-2004 12:35 AM
tar - how to extact only a single file from a archive? bkeating Linux - Newbie 3 10-23-2003 03:42 PM

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

All times are GMT -5. The time now is 11:39 PM.

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