compress a file 



mkszip [-cDdfRVv] [-b hash_bits] [-l comp_level] [-O output_directory] [file ...]


mkszip compresses each specified input file. If you do not specify any input files, mkszip reads data from the standard input and writes the compressed result to the standard output.

Output files have the same names as the input files but with a .gz suffix. For example, abc is compressed into abc.gz. The .gz suffix is appended regardless of existing suffixes; for example, abc.txt would be compressed into abc.txt.gz. If the .gz file already exists and you did not specify the -f option, mkszip prints an error and asks you whether or not it should overwrite the existing file.


-b hash_bits 

sets the size of the hash table to hash_bits. The value hash_bits may be an integer from 13 to 15. The default is 15.

-l comp_level 

sets the level of compression to comp_level. Higher values lead to greater compression but result in more time taken during the compression process. The value comp_level may be an integer from 0 to 9. The default is 9.


writes the output to the standard output. When you use this option, you can specify only one file on the command line.


allows an extra degree of compression for files such as sorted dictionaries where subsequent lines normally have many characters in common with the preceding line. This option is for text files only and should not be used with binary files. When decompressing a file compressed with this option, you must specify this option along with -d.


decompresses argument files instead of compressing them. This works by overlaying the mkszip program with the uncompress program. For this to work, uncompress must be available somewhere in your search path (given by the PATH environment variable). Decompressing files this way is slower than calling uncompress directly.


forces compression even if the resulting file is larger or the output file already exists. When you do not specify this option, files which are larger after compression are not compressed. mkszip does not print an error message if this happens.

-O output_directory

puts the output file in the specified output_directory.


specifies that the input file is not to be removed.


prints the version number of mkszip.


prints statistics giving the amount of compression achieved. Statistics give the name of each file compressed and the compression ratio, expressed as a percentage. If the file resulting from compression is larger than the original, the compression ratio is negative.



contains a list of directories for mkszip to search when looking for the uncompress utility.


MKS Toolkit supports hard links under 8.1/2012R2/10/2016/2019/11/2022 on NTFS file systems. There is a slight loss of performance for this support. If you do not require hard link support, you should set and export the environment variable TK_NTLINKS_OFF to disable this support.


Possible exit status values are:


Successful completion.


Failure because of one of the following errors:

— missing number of bits after -b option
— invalid number of bits specified
— failed to execute uncompress
— unknown option
— dictionary option -- same count of string exceeded
— output path or file name too long
— cannot stat file
— argument file not a regular file: unchanged
— argument file has other links: unchanged
— no space for compression tables

One or more files were not compressed because the compressed version was larger than the original.


Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


bzdiff, bzgrep, bzip2, bzmore, compress, cpio, gzip, pax, tar, uncompress, unpack, unzip, zcat, zip, zipinfo

MKS Toolkit Backup and Tape Handling Solutions Guide

PTC MKS Toolkit 10.4 Documentation Build 39.