← 返回命令列表

Linux command

zless 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

View a gzip compressed file

zless [file.gz]

View multiple compressed files sequentially

zless [file1.gz] [file2.gz]

Search for a pattern inside a compressed file

zless [file.gz]

Jump to the last line of a compressed file

zless [file.gz]

说明

zless is part of the gzip package. It works by setting `LESSOPEN` to pipe files through `gzip -cdfq` before passing them to less. This handles gzip (.gz) compressed files, as well as uncompressed files (gzip passes them through unchanged). The command provides the same interactive viewing experience as less, including forward and backward navigation, searching, and line jumping. Files are decompressed on the fly without creating temporary files. For broader format support (bzip2, xz, zstd, etc.), use less with lesspipe configured as the `LESSOPEN` preprocessor instead.

参数

Space
Scroll forward one screen.
b
Scroll backward one screen.
/_pattern_
Search forward for pattern.
?_pattern_
Search backward for pattern.
n
Repeat previous search.
N
Repeat previous search in reverse direction.
g
Go to first line.
G
Go to last line.
q
Quit.
h
Display help.

FAQ

What is the zless command used for?

zless is part of the gzip package. It works by setting `LESSOPEN` to pipe files through `gzip -cdfq` before passing them to less. This handles gzip (.gz) compressed files, as well as uncompressed files (gzip passes them through unchanged). The command provides the same interactive viewing experience as less, including forward and backward navigation, searching, and line jumping. Files are decompressed on the fly without creating temporary files. For broader format support (bzip2, xz, zstd, etc.), use less with lesspipe configured as the `LESSOPEN` preprocessor instead.

How do I run a basic zless example?

Run `zless [file.gz]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does Space do in zless?

Scroll forward one screen.