09-24-2011
Yes in some ways they are the same functionality they intend to compress data.
Some do better than others e.g gzip is better than compress and pack in overall .
compress and gzip are alike in some ways as they are exploit the same algorithm but they differ in some ways.
compress : The compress utility will attempt to reduce the size of the named files by using adaptive Lempel-Ziv coding. Typically, text such as source code or English is reduced by 50-60%. Compression is generally much better than that achieved by Huffman coding (as used in pack ).
pack : The pack command attempts to store the specified files in a compressed form. Wherever possible (and useful), each input file file is replaced by a packed file file.z with the same access modes, access and modified dates, and owner as those of file. If pack is successful, file will be removed.
gzip Is a GNU version of Lempel-Ziv coding (LZ77) which reduces the size of the named files using Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension ‘.gz’, while keeping the same ownership modes, access and modification times.
This User Gave Thanks to h@foorsa.biz For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have hundreds of ".Z" files that I need to uncompress and gzip. I'm not sure how to handle this in a 'for loop'. I can get the uncompress part, but I'm not sure how to strip the .Z off the filename for the gzip step. Is it possible to pipe the output of uncompress to gzip? (2 Replies)
Discussion started by: 98_1LE
2 Replies
2. UNIX for Dummies Questions & Answers
hi
i dont can traspassing file from unix sco compress whit pack or compress i dont can descompress whit other program... how i can do descompress that file in windows me.???
thank very much...
pd:sorry my inglish (6 Replies)
Discussion started by: jtapia
6 Replies
3. SCO
Our End of Day backup routine uses following script.
start End-of-day
compress $BASE TO /home/compdir
write /home/compdir to DATTAPE
end
where
$BASE=/home2/Rev83
DATATAPE=/dev/rmt/ctape1
write=cpio (not sure about parameters)
since I'm new to UNIX, i dont know how to restore data... (1 Reply)
Discussion started by: tayyabq8
1 Replies
4. UNIX for Dummies Questions & Answers
I am brand new to unix and am hoping someone can start me in the right direction.
I hope I have the right forum but if not can a moderator move this thread to the right area.
I am moving servers and need to back up a folder and its sub folders into a .tar.gz file then want to upload that file... (2 Replies)
Discussion started by: kushti
2 Replies
5. UNIX for Dummies Questions & Answers
hi can i know the diff between these 2 commands in terms of data compressed (3 Replies)
Discussion started by: anandapani
3 Replies
6. UNIX for Dummies Questions & Answers
I have a file that contains user id and corresponding password.
Lets say password is "help". The below command will create a hex value for string "help".
perl -e 'print unpack "H*","help"'
So now password is in encoded format.
Then I decoded it in the script where am fetching the... (1 Reply)
Discussion started by: max_payne1234
1 Replies
7. UNIX for Dummies Questions & Answers
Duplicate threads merged jmc
Hi,
I have a script wherein I want to use gzip instead of compress.
# cat dly_appsfiles_bkp.ksh
#
# dly_appsfiles_bkp.ksh
#
date_stamp=`date +%m%d%y`
base_dir=/u05/gld1
sub_dir=apps
bkp_dir=/u00/backup/GLD1/APPS... (5 Replies)
Discussion started by: narayanv
5 Replies
8. UNIX for Advanced & Expert Users
Hi,
in AIX 6.1 what is the limite of gzip and compress ?
I mean what can be at most the size of the file to compress ?
Thank you. (1 Reply)
Discussion started by: big123456
1 Replies
9. UNIX for Dummies Questions & Answers
I am using pack/unpack to encyrpt a file.
syntax is below
#!/bin/sh
encrypt=`perl -e 'print unpack "H*","yourpassword"'` -
echo $encrypt >/file/to/store/encrypted/password
pass=`cat /file/to/store/encrypted/password`
decrypt=`perl -e 'print pack "H*",$pass'` ... (2 Replies)
Discussion started by: erinlomo
2 Replies
10. UNIX for Beginners Questions & Answers
Good afternoon friends.
I wanted to make a query, how to compress several files and leave them all in 1, for example
flat text files:
filename_1.csv
filename_2.csv
filename_3.csv
expected result
filename_end.gzip = (filename_1.csv
filename_2.csv
filename_3.csv)
please (2 Replies)
Discussion started by: tricampeon81
2 Replies
LEARN ABOUT NETBSD
compress
COMPRESS(1) BSD General Commands Manual COMPRESS(1)
NAME
compress, uncompress -- compress and expand data
SYNOPSIS
compress [-cdfv] [-b bits] [file ...]
uncompress [-cdfv] [file ...]
DESCRIPTION
compress reduces the size of the named files using adaptive Lempel-Ziv coding. Each file is renamed to the same name plus the extension
``.Z''. As many of the modification time, access time, file flags, file mode, user ID, and group ID as allowed by permissions are retained
in the new file. If compression would not reduce the size of a file, the file is ignored.
uncompress restores the compressed files to their original form, renaming the files by deleting the ``.Z'' extension.
If renaming the files would cause files to be overwritten and the standard input device is a terminal, the user is prompted (on the standard
error output) for confirmation. If prompting is not possible or confirmation is not received, the files are not overwritten.
If no files are specified, the standard input is compressed or uncompressed to the standard output. If either the input and output files are
not regular files, the checks for reduction in size and file overwriting are not performed, the input file is not removed, and the attributes
of the input file are not retained.
The options are as follows:
-b Specify the bits code limit (see below).
-c Compressed or uncompressed output is written to the standard output. No files are modified.
-d Force decompression.
-f Force compression of file, even if it is not actually reduced in size. Additionally, files are overwritten without prompting for
confirmation.
-v Print the percentage reduction of each file.
compress uses a modified Lempel-Ziv algorithm. Common substrings in the file are first replaced by 9-bit codes 257 and up. When code 512 is
reached, the algorithm switches to 10-bit codes and continues to use more bits until the limit specified by the -b flag is reached (the
default is 16). Bits must be between 9 and 16.
After the bits limit is reached, compress periodically checks the compression ratio. If it is increasing, compress continues to use the
existing code dictionary. However, if the compression ratio decreases, compress discards the table of substrings and rebuilds it from
scratch. This allows the algorithm to adapt to the next "block" of the file.
The -b flag is omitted for uncompress since the bits parameter specified during compression is encoded within the output, along with a magic
number to ensure that neither decompression of random data nor recompression of compressed data is attempted.
The amount of compression obtained depends on the size of the input, the number of bits per code, and the distribution of common substrings.
Typically, text such as source code or English is reduced by 50-60%. Compression is generally much better than that achieved by Huffman cod-
ing (as used in the historical command pack), or adaptive Huffman coding (as used in the historical command compact), and takes less time to
compute.
The compress utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
zcat(1)
Welch, Terry A., "A Technique for High Performance Data Compression", IEEE Computer, 17:6, pp. 8-19, June, 1984.
HISTORY
The compress command appeared in 4.3BSD.
BSD
January 23, 2003 BSD