LinuxCommandLibrary

bzmore

Display compressed text files

SYNOPSIS

bzmore [more options] [file ...]

file ...: One or more paths to bzip2 compressed files to view.
more options: Any options understood by the more(1) pager are passed through directly to it.

PARAMETERS

file ...
    Specifies one or more paths to the bzip2 compressed files to be viewed. If no files are given, bzmore reads from standard input, assuming it contains bzip2 compressed data.

-s
    Passed to more(1): Squeeze multiple blank lines into a single blank line.

-d
    Passed to more(1): Display 'Press space to continue, 'q' to quit.' and print '[buffer empty]' when attempting to scroll past the end of the file.

-
    Passed to more(1): Display the specified number of lines per screen instead of the default. For example, -20 sets 20 lines per screen.

-p
    Passed to more(1): Do not scroll, but instead clear the screen and then display the next page. This option also allows specifying a filter command, though less commonly used with bzmore.

DESCRIPTION

bzmore is a convenient shell script that allows users to view the content of bzip2-compressed text files without explicitly decompressing them first. It functions as a wrapper around the bzip2 (or bunzip2) decompression utility and the more pager.

When bzmore is invoked with a filename, it first uses bzip2 -dc (or bunzip2 -c) to decompress the specified file to standard output. The decompressed data stream is then piped directly to the more command, which displays the content one screenful at a time, allowing for interactive navigation. This eliminates the need for manual decompression, making it efficient for quick file inspection. bzmore automatically handles multiple files sequentially and preserves the original compressed file, as it only reads and pipes the decompressed output. It's particularly useful for browsing logs, documentation, or any text-based data that has been compressed with bzip2.

CAVEATS

bzmore requires both the bzip2 (or bunzip2) utility and the more pager to be installed and accessible in the system's PATH.

It is designed for text files. Attempting to view bzip2-compressed binary files will result in garbled output due to on-the-fly decompression and display as text.

Performance can be affected by the size of the compressed file and system resources, as decompression happens in real-time.

Environment variables like PAGER or MORE can override the default pager used by bzmore (e.g., to less(1)), altering its interactive behavior.

ENVIRONMENT VARIABLES

PAGER: If set, this environment variable specifies the pager program to use instead of more(1). For example, setting PAGER=less will cause bzmore to use less(1) for paging.
MORE: If PAGER is not set, bzmore checks the MORE environment variable to determine the pager. This is typically less common than PAGER.

EXIT STATUS

bzmore typically exits with a status of 0 upon successful operation. Non-zero exit status indicates an error, such as a file not found, an invalid bzip2 file, or an error from the underlying more(1) command or bzip2 utility. The specific error code may depend on the component that failed.

HISTORY

bzmore emerged as part of the bzip2 compression suite, which was primarily developed by Julian Seward. The bzip2 project itself saw its first stable release, version 1.0, in 1996.

As a wrapper script, bzmore's existence is tied to the availability and popularity of bzip2 for compression and more (or less) for paging. Its design mirrors that of zmore(1), which performs a similar function for gzip-compressed files, providing a consistent user experience for viewing compressed data across different compression formats. It automates the common pattern of decompressing a file to standard output and piping it to a pager.

SEE ALSO

bzcat(1), bzip2(1), bunzip2(1), more(1), less(1), zmore(1), bzless(1)

Copied to clipboard