![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
Re: Compress - How small can a file before it will create the .Z
Quote:
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!! |
|
|||||
|
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. ![]() |
|
|||||
|
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. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|