COMPRESS(1)
okay so bestie, you're looking at the General Commands Manual page for compress and uncompress.real, and it's literally the blueprint for squishing your files down small and then popping them right back. main character compression energy, no cap. π¦β¨
β¨ NAME β¨
compress, uncompress.real β compress and expand data π
π SYNOPSIS π
compress [ -f ] [ -k ] [ -v ] [ -c ] [ -V ] [ -r ] [ -b bits ] [ -- ] [ name ... ]
uncompress.real [ -f ] [ -k ] [ -v ] [ -c ] [ -V ] [ -- ] [ name ... ]
π DESCRIPTION π
okay first things first, and this is important: the program that would normally be installed as uncompress is installed on Debian as uncompress.real. why? because otherwise it would beef with the way more commonly used program that has the exact same name and lives inside the gzip package. so yeah, .real it is. periodt. π
compress reduces the size of the named files using adaptive Lempel-Ziv coding. whenever possible, each file gets replaced by one with the extension .Z, while keeping the same ownership modes, access and modification times. the way it keeps your metadata? iconic. π
- if no files are specified, the standard input gets compressed to the standard output. π«Ά
compresswill only even attempt to compress regular files. in particular, it will ignore symbolic links, like, completely.- if a file has multiple hard links,
compresswill refuse to compress it unless the-fflag is given. it's not being dramatic, it just doesn't wanna break your links fr fr.
if -f is not given and compress is run in the foreground, the user gets prompted about whether an existing file should be overwritten. bestie gets a say. π
compressed files can be restored to their original form using uncompress.real. it takes a list of files on its command line and replaces each file whose name ends with .Z and which begins with the correct magic number with an uncompressed file without the .Z. the uncompressed file will have the mode, ownership and timestamps of the compressed file. glow-up, but make it metadata. β¨
now the flags, quick tour:
-kβ makescompress/uncompresskeep the input files instead of automatically removing them. hoarder mode, but respectful.-cβ makescompress/uncompress.realwrite to the standard output; no files are changed. it's giving "look but don't touch."-rβ if this flag is specified,compresswill operate recursively. if any of the file names specified on the command line are directories,compresswill descend into the directory and compress all the files it finds in there. when compressing, any files that are already compressed get ignored; when decompressing, any files that are already decompressed get ignored. it knows when to not do too much. π-Vβ tells each of these programs to print its version and patchlevel, along with any preprocessor flags specified during compilation, on stderr, before doing any compression or uncompression. receipts first, work second. π
π the algorithm bit (iykyk) π
compress uses the modified Lempel-Ziv algorithm popularized in "A Technique for High Performance Data Compression", Terry A. Welch, IEEE Computer, vol. 17, no. 6 (June 1984), pp. 8β19. π
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 (default 16). bits must be between 9 and 16. the default can be changed in the source to allow compress to be run on a smaller machine. tiny machine rights! π§
after the bits limit is attained, compress periodically checks the compression ratio. if it's 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. dramatic? no. adaptive. this allows the algorithm to adapt to the next "block" of the file. it's literally reinventing itself every era. π₯
note that the -b flag is omitted for uncompress.real, 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 file tells you what it needs. self-aware king. π
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 coding (as used in pack), or adaptive Huffman coding (compact), and takes less time to compute. not to compare but like... it ate. π
under the -v option, a message is printed yielding the percentage of reduction for each file compressed. π
-- may be used to halt option parsing and force all remaining arguments to be treated as paths. so if a filename is out here looking like a flag, you can shut that down. π
π DIAGNOSTICS π
exit status is normally 0; if the last file is larger after (attempted) compression, the status is 2; if an error occurs, exit status is 1.
here's every message and what it's actually telling you, bestie:
Usage: compress [-dfvcVr] [-b maxbits] [file ...]β invalid options were specified on the command line. πMissing maxbitsβ maxbits must follow-b.file: not in compressed formatβ the file specified touncompress.realhas not been compressed.file: compressed with xx bits, can only handle yy bitsβ the file was compressed by a program that could deal with more bits than thecompresscode on this machine. recompress the file with smaller bits.file: already has .Z suffix -- no changeβ the file is assumed to be already compressed. rename the file and try again.file: filename too long to tack on .Zβ the file cannot be compressed because its name is longer than 12 characters. rename and try again. this message does not occur on BSD systems. (so if you're not on BSD and your name is too long... yeah. βοΈ)file already exists; do you wish to overwrite (y or n)?β respond"y"if you want the output file to be replaced;"n"if not.uncompress.real: corrupt inputβ aSIGSEGVviolation was detected, which usually means that the input file has been corrupted. πCompression: xx.xx%β percentage of the input saved by compression. (relevant only for-v.)-- not a regular file or directory: ignoredβ when the input file is not a regular file or directory (e.g. a symbolic link, socket, FIFO, device file), it is left unaltered.-- has xx other links: unchangedβ the input file has links; it is left unchanged. seeln(1)for more information. use the-fflag to force compression of multiply-linked files.-- file unchangedβ no savings is achieved by compression. the input remains virgin. π
π BUGS π
although compressed files are compatible between machines with large memory, -b12 should be used for file transfer to architectures with a small process data space (64 KiB or less, as exhibited by the DEC PDP series, the Intel 80286, etc.) β so like, know your audience before you send the file. π«Ά
πΈ SEE ALSO πΈ
pack(1), compact(1)
and that's the whole page, bestie!! this one comes to you from ncompress, dated 2024-05-21 β go compress something and hydrate. πβ¨π¦
π¦ where this page comes from
- debian trixie: ncompress 5.0-3 Β· LicenseRef-public-domain
- ubuntu questing: ncompress 5.0-3
- ubuntu resolute: ncompress 5.0-4 Β· LicenseRef-public-domain
- ubuntu stonking: ncompress 5.0-4 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms