Compressing files with the vxcompress command

You can compress files with the vxcompress command. The vxcompress command performs the following functions:


Command syntax

Compress files or directory trees

vxcompress [-r] file_or_dir ...

Uncompress files or directory trees

vxcompress -u [-r] file_or_dir ...

Report the compression savings in a file or directory tree

vxcompress {-l|-L} [-r] file_or_dir ...

List the supported compression algorithms

vxcompress -a

See the vxcompress(1) manual page.

You can specify one or more filenames. If you specify the -r option, then you can specify directories, and the vxcompress command operates recursively on the directories.

You can specify the file compression algorithm and strength with the vxcompress -t command. The default algorithm is gzip, which is currently the only supported algorithm. The strength is a number from 1 to 9, with a default of 6. Strength 1 gives the fastest performance with least compression, while strength 9 gives the slowest performance with the greatest compression. For example, you specify strength 3 gzip compression as "gzip-3".

When reporting the compression details for a file, the vxcompress -l command or vxcompress -L command displays the following information:

If you attempt to compress a file with the vxcompress command and the extents have data that cannot be compressed, the command still marks the file as compressed and replaces the extents with compressed extent descriptors.

If you recompress a file, you do not need to specify any options with the vxcompress command. The command automatically uses the options that you used to compress the file previously.

The following command compresses the file1 file, using the default algorithm and strength of gzip-6:

$ vxcompress file1

The following command recursively compresses all files below the dir1 directory, using the gzip algorithm at the highest strength (9):

$ vxcompress -r -t gzip-9 dir1

The following command compresses the file2 file and all files below the dir2 directory, using the gzip algorithm at strength 3, while limiting the vxcompress command to a single thread and reducing the scheduling priority:

$ vxcompress -r -t gzip-3 file2 dir2

The following command displays the results of compressing the file1 file in human-friendly units:

$ vxcompress -L file1
%Comp   Physical    Logical  %Exts  Alg-Str  BSize  Filename
  99%       1 KB     159 KB   100%   gzip-6  1024k  file1

The following command uncompresses the file1 file:

$ vxcompress -u file1