COMPRESS(1POSIX)
๐ PROLOG ๐
okay so first things first, bestie โ this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not even be implemented on Linux at all. ๐
โจ NAME โจ
compress โ compress data ๐
๐ SYNOPSIS ๐
compress [-fv] [-b bits] [file...]
compress [-cfv] [-b bits] [file]
๐ฆ DESCRIPTION ๐ฆ
So the compress utility shall attempt to reduce the size of the named files by using adaptive Lempel-Ziv coding algorithm. That's the whole vibe. ๐
Note: Lempel-Ziv is US Patent 4464650, issued to <b>William Eastman</b>, <b>Abraham Lempel</b>, <b>Jacob Ziv</b>, <b>Martin Cohn</b> on August 7th, 1984, and assigned to <b>Sperry Corporation</b>. ๐ Lempel-Ziv-Welch compression is covered by US Patent 4558302, issued to <b>Terry A. Welch</b> on December 10th, 1985, and assigned to <b>Sperry Corporation</b>.
On systems that don't support adaptive Lempel-Ziv coding algorithm, the input files shall <b>not</b> be changed, and an error value greater than two shall be returned. no cap. ๐ญ
Except when the output is going to the standard output, each file shall be replaced by one with the extension .Z. If the invoking process has appropriate privileges, the ownership, modes, access time, and modification time of the original file are preserved. ๐
If appending the .Z to the filename would make the name exceed {NAME_MAX} bytes, the command shall fail. ๐ซ
If no files are specified, the standard input shall be compressed to the standard output. periodt. โจ
๐ OPTIONS ๐
The compress utility shall conform to the Base Definitions volume of POSIX.1โ2017, Section 12.2, Utility Syntax Guidelines.
The following options shall be supported:
-bbits โ specify the maximum number of bits to use in a code. For a conforming application, the bits argument shall be:
9 <= bits <= 14
The implementation may allow bits values of greater than 14. The default is 14, 15, or 16. (yeah it's a lil choose-your-own-adventure, iykyk ๐)
-cโ causecompressto write to the standard output; the input file is <b>not</b> changed, and <b>no</b>.Zfiles are created. so chill ๐ง-fโ force compression of file, even if it doesn't actually reduce the size of the file, or if the correspondingfile.Zfile already exists. If the-foption is not given, and the process is <b>not</b> running in the background, the user is prompted as to whether an existingfile.Zfile should be overwritten. If the response is affirmative, the existing file will be overwritten. ๐-vโ write the percentage reduction of each file to standard error. slay, numbers! ๐ฅ
๐ธ OPERANDS ๐ธ
The following operand shall be supported:
- file โ a pathname of a file to be compressed. ๐
๐ STDIN ๐
The standard input shall be used <b>only</b> if no file operands are specified, or if a file operand is '-'. ๐ซถ
โญ INPUT FILES โญ
If file operands are specified, the input files contain the data to be compressed. that's it, that's the tea โ
๐ ENVIRONMENT VARIABLES ๐
The following environment variables shall affect the execution of compress:
LANGโ provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1โ2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) ๐LC_ALLโ if set to a non-empty string value, override the values of all the other internationalization variables. main character energy fr ๐LC_COLLATEโ determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements used in the extended regular expression defined for theyesexprlocale keyword in theLC_MESSAGEScategory.LC_CTYPEโ determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments), the behavior of character classes used in the extended regular expression defined for theyesexprlocale keyword in theLC_MESSAGEScategory. ๐คLC_MESSAGESโ determine the locale used to process affirmative responses, and the locale used to affect the format and contents of diagnostic messages, prompts, and the output from the-voption written to standard error. ๐ฌNLSPATHโ determine the location of message catalogs for the processing ofLC_MESSAGES. ๐๏ธ
๐ง ASYNCHRONOUS EVENTS ๐ง
Default. no drama. โจ
๐ STDOUT ๐
If no file operands are specified, or if a file operand is '-', or if the -c option is specified, the standard output contains the compressed output. ๐
๐ฉท STDERR ๐ฉท
The standard error shall be used <b>only</b> for diagnostic and prompt messages and the output from -v. ๐คซ
๐ OUTPUT FILES ๐
The output files shall contain the compressed output. The format of compressed files is unspecified, and interchange of such files between implementations (including access via unspecified file sharing mechanisms) is <b>not</b> required by POSIX.1โ2008. ๐
๐ EXTENDED DESCRIPTION ๐
None. (we love a low-effort section, iconic) ๐
๐ฅ EXIT STATUS ๐ฅ
The following exit values shall be returned:
0โ successful completion. โจ1โ an error occurred. ๐ญ2โ one or more files were not compressed because they would have increased in size (and the-foption was not specified).>2โ an error occurred. ๐ซ
๐ CONSEQUENCES OF ERRORS ๐
The input file shall remain unmodified. ok so at least there's that ๐ซถ
The following sections are informative.
๐ฆ APPLICATION USAGE ๐ฆ
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 or adaptive Huffman coding (compact), and takes less time to compute. ate and left no crumbs ๐
Although compress strictly follows the default actions upon receipt of a signal or when an error occurs, some unexpected results may occur. In some implementations it is likely that a partially compressed file is left in place, alongside its uncompressed input file. Since the general operation of compress is to delete the uncompressed file only <b>after</b> the .Z file has been successfully filled, an application should <b>always</b> carefully check the exit status of compress before arbitrarily deleting files that have like-named neighbors with .Z suffixes. ๐
The limit of 14 on the bits option-argument is to achieve portability to all systems (within the restrictions imposed by the lack of an explicit published file format). Some implementations based on 16-bit architectures cannot support 15 or 16-bit uncompression. noted, bestie ๐
๐ EXAMPLES ๐
None. (no examples, just vibes) โจ
๐ง RATIONALE ๐ง
None.
๐ฎ FUTURE DIRECTIONS ๐ฎ
None.
๐ SEE ALSO ๐
uncompress, zcat
The Base Definitions volume of POSIX.1โ2017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
๐ COPYRIGHT ๐
Portions of this text are reprinted and reproduced in electronic form from <b>IEEE Std 1003.1-2017</b>, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie โ brought to you by the <b>IEEE/The Open Group</b>, <b>2017</b>, filed under <b>COMPRESS(1POSIX)</b>. now go compress something and slay ๐ โจ๐
๐ฆ where this page comes from
- debian bookworm: manpages-posix 2017a-2 ยท Other
- debian trixie: manpages-posix 2017a-2 ยท Other
- ubuntu jammy: manpages-posix 2017a-2 ยท Other
- ubuntu noble: manpages-posix 2017a-2 ยท Other
- ubuntu resolute: manpages-posix 2017a-2build1 ยท Other
- ubuntu stonking: manpages-posix 2017a-2.1 ยท Other
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms