Compressed logs, old text exports, and archived command output are easier to inspect when you can page through them without unpacking a temporary copy. The bzmore command in Linux opens bzip2-compressed text through a simple more-style pager, which is useful when you only need a quick read, a search, or a short review of a .bz2 file.
bzmore belongs to the bzip2 utility family. Use it for interactive viewing, not for script logic or archive validation. For scriptable output, use the bzcat command; for integrity checks, use bzip2 -t; and when you need backward scrolling or richer pager controls, use bzless for .bz2 files where your distribution ships it or pipe decompressed output into less command examples.
Understand the bzmore Command
bzmore is a wrapper that sends bzip2-decompressed text into a pager. In a real terminal, it pauses after each screenful so you can move through the content with keyboard commands. When standard output is redirected or piped, it prints file headers and streams the decompressed content, which matters if you use it inside other commands.
bzmore [FILE...]
FILE: One or more bzip2-compressed text files, normally ending in.bz2. Current packaged wrappers also display plain text files, but the command is still meant for text, not binary data.- Interactive pager keys: After
bzmorepauses, keys such as Space, Enter, q, /, and n control movement and search. - Wrapper boundary:
bzmoredoes not behave like a normal option-rich command. Avoid startup flags unless you have checked your local wrapper. Open the file first, then use pager keys.
The Ubuntu bzmore man page documents the interactive command set, and the official bzip2 manual documents the underlying compressor and decompressor behavior.
bzmore Quick Reference
| Task | Command or Key | What It Does |
|---|---|---|
| Open a bzip2 text file | bzmore app.log.bz2 | Pages through the decompressed text in the terminal. |
| Read from standard input | bzmore < app.log.bz2 | Decompresses and pages a bzip2 stream from stdin. |
| Move one screen forward | Space | Shows the next page of text. |
| Move one line forward | Enter | Shows one more line. |
| Scroll part of a page | d or Ctrl+D | Displays 11 more lines by default. |
| Search forward | /ERROR | Finds the next match for a regular expression. |
| Repeat the last search | n | Finds the next occurrence of the previous search. |
| Show current line number | = | Prints the line number at the current position. |
| Quit the current file | q | Leaves the current file and advances to the next file when one was provided. |
| Search without a pager | bzgrep '^ERROR' app.log.bz2 | Searches compressed text directly when bzgrep is available. |
| Filter text for scripts | bzcat app.log.bz2 | grep '^ERROR' | Uses clean decompressed stdout without bzmore headers. |
| Check file integrity | bzip2 -t app.log.bz2 | Tests whether the file is valid bzip2 data. |
Use explicit filenames such as
app.log.bz2. Several current Linux wrappers pass the exact operand tobzip2, so relying on an automatic.bz2suffix fallback can print a missing-file error while still returning status0.
Install or Verify bzmore on Linux
The distro package named bzip2 normally provides bzmore, bzip2, bunzip2, bzcat, and related helpers such as bzgrep. Some fresh or minimal systems may omit the package even when full desktop or server installs often include it.
Check whether your shell can find bzmore:
command -v bzmore
A common installed path is:
/usr/bin/bzmore
If the command is missing, install bzip2 with your package manager. Use only the line that matches your distribution family:
sudo apt install bzip2 # Debian, Ubuntu, and Linux Mint
sudo dnf install bzip2 # Fedora, Rocky Linux, AlmaLinux, and CentOS Stream
sudo zypper install bzip2 # openSUSE
sudo pacman -S bzip2 # Arch Linux and Manjaro
After installation, repeat command -v bzmore. If you plan to use bzgrep for direct searches or the richer bzless wrapper for backward movement, check those helpers separately because not every distribution package exposes the same wrapper set:
command -v bzgrep || printf 'bzgrep is not installed\n'
command -v bzless || printf 'bzless is not installed\n'
Use the underlying bzip2 help output when you need the package utility version. The first line prints the packaged compressor version, and the exact number can differ between rolling distributions and older enterprise releases:
bzip2 --help 2>&1 | sed -n '1p'
bzmore --version usually displays a bzmore file header and then the underlying bzip2 version text, so it is not a clean bzmore-specific version check.
Create Practice Files for bzmore Examples
A disposable directory keeps the examples away from real logs. Keep the same terminal session open because the $demo variable stores the cleanup path.
demo=$(mktemp -d "$HOME/bzmore-demo.XXXXXX")
cd "$demo"
cat <<'EOF' > app.log
INFO start
WARN cache warmup slow
ERROR disk full
INFO done
EOF
cat <<'EOF' > notes.txt
Project notes
Archive created before maintenance
Check ERROR lines before deleting old logs
EOF
mkdir archive-src
printf 'setting=true\n' > archive-src/app.conf
printf 'archive readme\n' > archive-src/README.txt
printf 'suffix fallback check\n' > suffix.log
bzip2 -k app.log notes.txt
tar -cjf archive.tar.bz2 archive-src/app.conf archive-src/README.txt
bzip2 suffix.log
printf 'not a bzip2 stream\n' > bad.bz2
ls -1
The directory contains the original text files, their compressed copies, an archive source directory, a .tar.bz2 archive, and one deliberately bad .bz2 file for troubleshooting:
app.log app.log.bz2 archive-src archive.tar.bz2 bad.bz2 notes.txt notes.txt.bz2 suffix.log.bz2
View bzip2 Files with bzmore
Start with a direct file operand when you want interactive paging. The file stays compressed on disk; bzmore only streams decompressed text to the pager.
bzmore app.log.bz2
In a normal terminal, bzmore shows the first screenful and pauses at a --More-- prompt. Press Space for the next page, Enter for one line, or q to quit.
Search Inside a Compressed File
Open the file, then type a slash and a search expression at the pager prompt:
bzmore app.log.bz2
At the pager prompt, type /ERROR to find the first matching line. Use n to repeat the search, = to show the current line number, and q when you are finished. Search uses regular expressions, so simple words work, but characters such as ., *, and [ have pattern meaning.
Open Multiple Compressed Files
Pass multiple files when you want to review several compressed text files in sequence:
bzmore app.log.bz2 notes.txt.bz2
After the first file ends, bzmore prompts before opening the next file. Press q to leave the current file and continue, s to skip the next file at the next-file prompt, or e to exit completely when that prompt appears.
View a bzip2 Stream from Standard Input
When a command or redirection gives bzmore compressed data on standard input, omit the filename:
bzmore < app.log.bz2
This form is useful for quick checks of a downloaded or generated bzip2 stream. For repeatable scripts, prefer bzip2 -dc or bzcat so output stays predictable.
Search and Filter bzip2 Files Without bzmore
bzmore is not the cleanest command for pipelines because non-interactive output includes a file header. This visible behavior is useful in a terminal transcript, but it can surprise scripts that expect only decompressed file content.
bzmore app.log.bz2 | sed -n '1,6p'
Relevant output includes the header plus the file content:
------> app.log.bz2 <------ INFO start WARN cache warmup slow ERROR disk full INFO done
Use bzcat when another command should read only the decompressed bytes. This pattern is better for filters, scripts, and saved reports:
bzcat app.log.bz2 | grep '^ERROR'
ERROR disk full
Search Compressed Text with bzgrep
For a quick search without opening a pager or writing a pipeline, use the bzgrep command when it is available. It applies grep-style matching to bzip2-compressed input:
bzgrep '^ERROR' app.log.bz2
ERROR disk full
Keep bzmore for interactive reading, where the pager prompt and file header are helpful rather than noisy. Use grep command filtering patterns when the search logic becomes more complex than a single bzgrep match.
Handle Common bzmore File Types
Plain .bz2 Text Files
bzmore works best with a single compressed text stream, such as rotated logs, SQL dumps, configuration exports, and saved command output:
bzmore notes.txt.bz2
If you need to compare two compressed text files instead of reading one, use bzdiff command examples so the comparison tool handles decompression and diff output together.
Compressed Tar Archives
A .tar.bz2 or .tbz2 file is not just text compressed with bzip2. It is a tar archive wrapped in bzip2 compression. Use tar to list archive members before extracting or inspecting individual files:
tar -tjf archive.tar.bz2
The practice archive lists members instead of readable file content:
archive-src/app.conf archive-src/README.txt
Use the tar command examples when you need to list, extract, or create archive files. bzmore archive.tar.bz2 usually shows tar headers or binary-looking output, not a clean member-by-member view.
gzip and Other Compression Formats
bzmore targets bzip2 streams. It is not the right tool for .gz, .xz, .zip, or .zst files. Use format-specific tools instead, such as zmore or gzip command examples for gzip-compressed files.
Avoid bzmore Wrapper Traps
Do Not Treat bzmore as an Integrity Check
bzmore is forgiving because it is meant to show text. A file named bad.bz2 can still print as plain text if the content is not actually compressed. Test suspect files with bzip2 -t before you trust them as bzip2 data:
bzip2 -t bad.bz2
Relevant output includes the bad-magic line and the recovery hint:
bzip2: bad.bz2: bad magic number (file not created by bzip2) You can use the `bzip2recover' program to attempt to recover data from undamaged sections of corrupted files.
Use the correct file, retrieve a fresh copy, or inspect the content as plain text only after you know the extension is misleading. If the file is a damaged bzip2 archive and the data matters, recover from a backup or use the bzip2recover command in a separate scratch directory before trusting partial output.
Use Explicit .bz2 Filenames
Some man pages describe a fallback where bzmore suffix.log searches for suffix.log.bz2 when suffix.log is missing. Current wrappers on several common distributions do not implement that fallback consistently. If you created the practice files above, suffix.log.bz2 exists but suffix.log does not:
bzmore suffix.log
When the suffix fallback fails, the wrapper can still return status 0 while printing a missing-file message:
------> suffix.log <------ bzip2: Can't open input file suffix.log: No such file or directory.
If you omit the suffix and see a missing-file error, repeat the command with the actual .bz2 filename:
bzmore suffix.log.bz2
Do not use bzmore exit status as the only success check because these wrapper errors can still return status 0.
Do Not Use more Options as bzmore Options
Option-looking arguments such as -n or startup searches such as +/ERROR can be treated as filenames or forwarded to bzip2 in surprising ways:
bzmore -n app.log.bz2
Relevant output can start with the failed option operand before bzmore continues to the real file:
------> -n <------ bzip2: Bad flag `-n'
Use pager commands after the file opens. Type /ERROR inside the pager for search, press = for the current line number, and use bzgrep '^ERROR' app.log.bz2 or bzcat app.log.bz2 | grep '^ERROR' when you need a non-interactive search.
Use bzless or less When You Need Backward Movement
bzmore is a simple forward-oriented pager. If your distribution ships bzless, it usually gives the better day-to-day review experience because less supports backward scrolling, richer search behavior, and more startup options.
if command -v bzless >/dev/null 2>&1; then
bzless app.log.bz2
else
printf 'bzless is not installed\n'
fi
If bzless is missing but less is installed, pipe decompressed output into less instead:
bzcat app.log.bz2 | less
Press q to close less after reviewing the decompressed text.
Troubleshoot bzmore Problems
bzmore command not found
This error means the shell cannot find the wrapper. Confirm the command lookup first:
command -v bzmore
No output means the command is unavailable in the current shell. Install the bzip2 package for your distribution, then open a new terminal if your shell does not refresh command paths automatically:
sudo apt install bzip2 # Debian, Ubuntu, and Linux Mint
sudo dnf install bzip2 # Fedora, Rocky Linux, AlmaLinux, and CentOS Stream
sudo zypper install bzip2 # openSUSE
sudo pacman -S bzip2 # Arch Linux and Manjaro
Retest the wrapper path after the package install:
command -v bzmore
bzip2: Can’t open input file
This error usually means the operand does not match a real path. Check the compressed file exists, then use its exact name:
ls -l app.log.bz2
bzmore app.log.bz2
If the file is in another directory, pass the path explicitly. Do not depend on bzmore app.log finding app.log.bz2 for you.
The output looks like binary data
The file may be a compressed archive, database dump with binary sections, or a mislabeled file. Identify the file type before reading it as text:
file archive.tar.bz2
bzip2 -t archive.tar.bz2
Use tar -tjf archive.tar.bz2 for tar archives. Use bzip2 -t for integrity. Reserve bzmore for text streams that are useful to inspect in a pager.
Search or line-number options do not work
bzmore uses interactive commands after the file opens. Startup options that work with more or less may not work through the bzmore wrapper. Open the file normally, type /pattern at the pager prompt, and press = for the current line number.
For repeatable searches, avoid the pager wrapper and use bzgrep or a decompression pipeline:
bzgrep '^ERROR' app.log.bz2
bzcat app.log.bz2 | grep '^ERROR'
Clean Up the bzmore Practice Directory
Remove the disposable files when you are finished with the examples. This cleanup targets only the directory created in the current shell session:
cd "$HOME"
if [ -n "${demo:-}" ] && [ -d "$demo" ]; then
rm -rf -- "$demo"
fi
unset demo
Conclusion
bzmore is a quick pager for bzip2-compressed text when you know its wrapper limits: open explicit .bz2 paths, search inside the pager, and switch to bzgrep or bzcat for non-interactive searches, bzip2 -t for validation, bzdiff for comparison, or tar for archive handling.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><a href="https://example.com">link</a><blockquote>quote</blockquote>