How to Read Compressed lzma Files Using the lzmore Command in Linux

When you compress a large text file or database dump using the legacy lzma (Lempel-Ziv-Markov chain algorithm) utility, the resulting .lzma file is heavily compressed into a binary format. If you attempt to open this file with standard terminal tools like cat, the terminal will crash or output pages of corrupted gibberish. If you simply need to view a few lines of the text, decompressing the entire massive file back to your hard drive is incredibly inefficient. To read the data instantly, you can use the lzmore command.

How the lzmore Command Works

The lzmore utility is a simple wrapper script that acts as a bridge between the lzma decompression algorithm and the very old, very basic more terminal pager. When you run the command against a compressed file, it decompresses the text directly into your computer’s RAM (bypassing the hard drive) and pipes it to your screen.

To view a compressed file named old_database.sql.lzma, simply run:

lzmore old_database.sql.lzma

Navigating with lzmore

Because the output is routed through the legacy more pager, your navigation options are extremely limited compared to modern tools.

Once the file opens, the text will stop at the bottom of your first screen. In the bottom left corner, a percentage indicator (e.g., --More--(15%)) will show you how much of the file you have read.

  • Enter Key: Press the Enter key to advance the text exactly one single line.
  • Spacebar: Press the Spacebar to advance the text exactly one full page (or screen) at a time.

The Critical Limitation: The more pager is strictly unidirectional. You can only scroll down. You cannot use your arrow keys to scroll back up, and you cannot jump backward to a previous page. If you accidentally hit the spacebar and skip past the paragraph you wanted to read, you must quit the program and start over.

To quit the pager and return to your bash prompt, simply press the q key.

Searching for Text

Despite its severe limitations, lzmore does support forward-searching.

  1. While viewing the file, type a forward slash (/).
  2. Type the word you are looking for (e.g., /username) and press Enter.
  3. The pager will jump forward to the first occurrence of that phrase.

Because you cannot scroll backward, if the word you searched for actually occurred on page 1, and you were currently reading page 10 when you initiated the search, lzmore will fail to find it, as it only searches the text that lies ahead.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.