zless
View compressed text files
TLDR
Page through a gzip compressed file with less
SYNOPSIS
zless [options] [file...]
PARAMETERS
-?
Display help and exit.
-V
Display version information and exit.
+
Specifies a command to be executed each time a new file is examined. For example, +G causes less to initially display the end of each file, and +? causes less to display help at the beginning of each file.
-c
Causes older versions of less to exit after displaying only one file. This is usually not necessary, as newer versions of less handle multiple files automatically.
-e
Causes less to automatically exit after reaching the end of the first file.
-f
Forces opening of device files.
-g
Only highlight the current search match.
-i
Ignore case in searches that do not contain upper case.
-I
Ignore case in all searches.
-m
Display a more verbose prompt with the current filename.
-n
Suppress line numbers.
-N
Display line numbers.
-o
Copy input to file. Only works if the input is single file.
-O
Copy input to file without asking for confirmation. Only works if the input is single file.
-q
Quiet mode.
-s
Squeeze multiple blank lines into one.
-S
Chop long lines rather than folding them.
-x
Set tab stops to every
-z
Cause less to interpret "control" characters in the manner of more.
-NUM
Specifies a numerical value to be used as the default for certain parameters.
-+
Causes the specified option to be turned back to its default setting.
--
Signals the end of option flags.
DESCRIPTION
zless is a pager command in Unix-like operating systems similar to less, but it is designed specifically for viewing the contents of compressed text files. It allows you to view files compressed with gzip (.gz), compress (.Z), bzip2 (.bz2), or xz (.xz) without having to manually decompress them first. It utilizes the less command internally, automatically decompressing the file before piping it to less. This provides a convenient way to navigate, search, and read large compressed files in a terminal. This provides a seamless experience for users working with compressed data, enhancing productivity and simplifying file viewing processes. zless also provides support for reading from standard input if needed.
While often implemented as a shell script, it's essentialy a wrapper that decompresses a file and pipes it to the less pager program.
CAVEATS
zless relies on the presence of appropriate decompression utilities (like gzip, bzip2, xz). If these are not installed, zless may not be able to decompress the files.
EXIT CODES
Exit status of zless is the same as the exit status of less.
FILE RECOGNITION
zless automatically detects file compression type based on file extensions (.gz, .bz2, .xz, .Z). It uses the appropriate decompression command before sending the output to less.
HISTORY
zless evolved as a convenient tool to simplify the process of viewing compressed files directly without manual decompression. It leverages existing utilities like less and decompression programs to provide a seamless viewing experience. Its usage has become widespread in environments dealing with large volumes of compressed text data.