The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
unix script to takes the old data from a TXT file and compress them into new file vpandey Shell Programming and Scripting 2 03-05-2008 11:10 AM
Scripts for File Compress moorthygs Shell Programming and Scripting 0 09-14-2007 03:33 AM
compress more than one file prasee UNIX for Advanced & Expert Users 2 09-08-2007 10:15 AM
Compress a file before ftp MrMac Shell Programming and Scripting 1 11-21-2006 09:06 AM
[help] Cant compress file endeavour1985 UNIX for Dummies Questions & Answers 8 01-18-2005 12:37 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-12-2002
app4dxh
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Talking Compress - How small can a file before it will create the .Z

I am just curious. Compress by itself will not compress a file of zero bytes. (I know gzip does)

Without using compress -f, at what point will compress work. In other words, what is the smallest the file can be before it will create the .Z file?

Some of us here are just wondering...

Thx
  #2 (permalink)  
Old 09-12-2002
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
Re: Compress - How small can a file before it will create the .Z

Quote:
Originally posted by app4dxh
I am just curious. Compress by itself will not compress a file of zero bytes. (I know gzip does)

Without using compress -f, at what point will compress work. In other words, what is the smallest the file can be before it will create the .Z file?

Some of us here are just wondering...

Thx
sounds like you can test this one out on your own.

heck you can even write a script to start with a zero byte file and try to compress it then test the return value of the commpress command and if it failed then add 1 byte to the file then try again. adn so on. till you get a match.


look forward to your test results!!
  #3 (permalink)  
Old 09-13-2002
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
I think it has less to do with file size than the "compressibility" of the data inside. I've seen fairly large files not be able to be compressed. Or you could try taking a 100mb file, compressing it to, say, 70mb with gzip, then running compress on it. I doubt compress could further compress the file without actually adding to the file size.

I'm not familiar with compression algorithms', though, so I might be just hot air...
  #4 (permalink)  
Old 09-17-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
I agree that the size doesn't matter (ha!).

If you have a file with the value of PI. I believe that it doesn't have any repeating chars or blanks. So it probably wouldn't be compressed at all. However, a file with six bytes that has a space in the middle would be compressed.

I might be somewhat incorrect, but I think most of the compression algorithm has to do with repeating of chars and patterns and blanks, more than anything else.

  #5 (permalink)  
Old 09-17-2002
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Actually, size does matter. And gzip will compress a file no matter what.

From the man page -

Gzip uses the Lempel-Ziv algorithm used in zip and PKZIP.
The amount of compression obtained depends on the size of
the input and the distribution of common substrings. Typi-
cally, text such as source code or English is reduced by
60-70%. Compression is generally much better than that
achieved by LZW (as used in compress), Huffman coding (as
used in pack), or adaptive Huffman coding (compact).

Compression is always performed, even if the compressed file
is slightly larger than the original
. The worst case expan-
sion is a few bytes for the gzip file header, plus 5 bytes
every 32K block, or an expansion ratio of 0.015% for large
files. Note that the actual number of used disk blocks
almost never increases. gzip preserves the mode, ownership
and timestamps of files when compressing or decompressing.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0