bzmore command in Linux is used as a filter for CRT viewing of bzip2 compressed files, which are saved with
.bz2 suffix. In simple words, using ‘bzmore’, the content of the file can be viewed on the screen without uncompressing the file. bzip2 is a block-sorting file compressor which compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. bzip2 compresse files more effectively than the older Deflate (.zip and .gz) and LZW (.Z) compression algorithms, but is slower.
While the bzip2 command line utility can be used to compress files, there are many other tools that let you perform basic tasks – like searching, comparing, and more without the need to uncompress them. bzmore is just like ‘more‘ command in Linux but it is mainly used for compressed bz2 files. bzmore allows examination of compressed files one screenful at a time on the terminal and pauses, with the bottom line printing “–More–” on the screen. For performing further tasks on the terminal, various options are available.
bzmore [ name ...]
Example: A text file named GFG.txt is compressed via bzip2. After the compression, the file is saved as
GFG.txt.bz2. In this file, for instance contains numbers ranging from 1 to 40 like this:
1 2 3 . . . 40
Now, To view the contents of this file execute the following command:
This command prints a screenful of text on the terminal.
Options: These options are executed on the ‘–More–‘ statement present in the end of the terminal.
- d : It displays 11 more lines on the terminal. It means a 11 lines scroll is performed.
- i(space) : It displays i more lines on the terminal. If no i is given, it shows another screenful scroll. Here, i is an integer argument, defaulting to 1.
- iz : This option displays i more lines same as i(space) and the scroll is now set to i.
- is : It skips i number of lines and prints the lines according to the previously saved i. If no i is given, it then print screenful of lines.
Note: The previously saved i in option3 was 5, so this options skipped 2 lines as commanded and then a 5 line scroll is printed.
- if : This option skips whole i screenfuls and print a screenful of lines. If i is already saved using previous commands, this command skips i(previous) * i(present) lines and print a screenful of lines.
Example 1: In this example, no i is previously saved.
Example 2: In this example, i=2 is saved previously using the command 2z.
Note: 4 ( 2*2 ) lines are skipped on the terminal and 2 lines are printed because of the previously saved i=2.
- q : This command lets quit the reading of the current file.
- = (equals): It shows the current line number on the terminal.
- . (dot) : This command repeats the previously entered command.
Note: The previously entered command was 2(space), so two lines are printed and then by using .(dot) command previously entered command is repeated.
- –help: It displays help information.
$ bzmore --help
- –version: It displays version information.
$ bzmore --version