bunzip2

file compressionLinux
The bunzip2 command is one of the most frequently used commands in Linux/Unix-like operating systems. bunzip2 Decompress files compressed with bzip2

Quick Reference

Command Name:

bunzip2

Category:

file compression

Platform:

Linux

Basic Usage:

bunzip2 [options] [arguments]

Common Use Cases

    Syntax

    bunzip2 [OPTIONS] [FILE...]

    Options

    Option Description
    -c, --stdout Decompress to standard output
    -d, --decompress Force decompression mode
    -f, --force Force overwrite of output files
    -k, --keep Keep input files after decompression
    -s, --small Use less memory (at the expense of speed)
    -t, --test Test compressed file integrity
    -v, --verbose Show verbose output
    -L, --license Display software license
    -V, --version Display version information
    -q, --quiet Suppress all warnings

    Examples

    How to Use These Examples

    The examples below show common ways to use the bunzip2 command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    bunzip2 file.bz2
    Decompress file.bz2 and remove the .bz2 extension.
    bunzip2 -k file.bz2
    Decompress file.bz2 but keep the original compressed file.
    bunzip2 -v file1.bz2 file2.bz2
    Decompress multiple files with verbose output. # Advanced Examples Advanced bunzip2 -t archive.bz2 Test the integrity of the compressed file without decompressing. bunzip2 -f file.bz2 Force decompression even if output file already exists. bunzip2 -c file.bz2 > output.txt Decompress to standard output and redirect to a file.

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The bunzip2 command is a decompression tool that extracts files compressed with bzip2 compression. It's part of the bzip2 compression utilities package. Key features of bunzip2: 1. **Efficient Decompression**: Restores files compressed with the bzip2 algorithm, which typically provides better compression than gzip. 2. **File Handling**: By default, bunzip2 removes the compressed file after successful decompression. Use the -k option to keep the original. 3. **File Integrity**: The -t option allows verifying the integrity of compressed files without actually decompressing them. 4. **Automatic Extension Handling**: bunzip2 automatically removes the .bz2 extension from decompressed files. 5. **Stream Support**: Can decompress data from standard input or output to standard output, making it useful in pipelines. Common use cases: - Decompressing downloaded software archives - Extracting compressed log files - Processing compressed data in shell scripts - Verifying the integrity of bzip2 archives bunzip2 is actually a symbolic link to the bzip2 program, which detects whether to compress or decompress based on how it's invoked. When called as bunzip2, it operates in decompression mode.

    Related Commands

    These commands are frequently used alongside bunzip2 or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the bunzip2 command works in different scenarios.

    $ bunzip2
    View All Commands