LinuxCommandLibrary

lzless

View compressed files without decompressing

TLDR

View documentation for the original command

$ tldr xzless
copy

SYNOPSIS

lzless [less_options] [file...]

PARAMETERS

[less_options]
    Options accepted by lzless are typically passed directly to the less pager. lzless itself does not have unique command-line options beyond those for the decompressor or pager. Common less options that can be used include:
-i: Ignore case in searches.
-N: Display line numbers.
-S: Chop long lines rather than wrapping.
+G: Start at the end of the file.
-R: Output "raw" control characters (e.g., for colored text).

[file...]
    One or more paths to LZMA or LZMA2 compressed files to be viewed. If no file is specified, lzless reads LZMA/LZMA2 compressed data from standard input.

DESCRIPTION

The lzless command is a convenient shell script that allows users to view the content of LZMA or LZMA2 compressed files without explicitly decompressing them to disk.

It functions by piping the output of the xz (or older lzma) decompressor directly into the less pager. This provides an interactive viewing experience, similar to viewing regular text files with less, including scrolling, searching, and navigating. Users do not need to worry about managing temporary decompressed files, as lzless handles the decompression and piping on the fly.

It's particularly useful for quickly inspecting log files, documentation, or other data that has been stored in LZMA or LZMA2 format to save space.

CAVEATS

lzless relies on the availability of the xz (or lzma) decompressor and the less pager. If these commands are not installed or are not in the system's PATH, lzless will fail. The input file(s) must be valid LZMA or LZMA2 compressed data; otherwise, decompression errors will occur, and content may not be displayed correctly.

ENVIRONMENT VARIABLES

lzless's behavior can be influenced by environment variables, primarily those used by its underlying commands:
LESS: Specifies command-line options for less that are automatically applied.
XZ_DECOMPRESS_OPTS: Options passed to the xz decompressor (less common for lzless, as lzless usually only needs default decompression).

HISTORY

The concept of transparently viewing compressed files through a pager has existed for a long time in Unix-like systems, notably with zless (for gzip) and bzless (for bzip2). lzless emerged as LZMA and later LZMA2 (used by xz) compression gained popularity for its higher compression ratios. It is typically part of the xz-utils package, which superseded older lzma_utils, ensuring compatibility with the modern xz command for LZMA2 decompression.

SEE ALSO

less(1), xz(1), lzma(1), zless(1), bzless(1)

Copied to clipboard