LinuxCommandLibrary

7zr

Create and extract 7z archives

TLDR

[a]rchive a file or directory

$ 7zr a [path/to/archive.7z] [path/to/file_or_directory]
copy

Encrypt an existing archive (including file names)
$ 7zr a [path/to/encrypted.7z] -p[password] -mhe=[on] [path/to/archive.7z]
copy

E[x]tract an archive preserving the original directory structure
$ 7zr x [path/to/archive.7z]
copy

E[x]tract an archive to a specific directory
$ 7zr x [path/to/archive.7z] -o[path/to/output]
copy

E[x]tract an archive to stdout
$ 7zr x [path/to/archive.7z] -so
copy

[l]ist the contents of an archive
$ 7zr l [path/to/archive.7z]
copy

Set the level of compression (higher means more compression, but slower)
$ 7zr a [path/to/archive.7z] -mx=[0|1|3|5|7|9] [path/to/file_or_directory]
copy

SYNOPSIS

7zr command [options] archive [files...]

PARAMETERS

a
    Add files to archive.

e
    Extract files from archive (without using directory names).

x
    Extract files with full paths.

l
    List contents of archive.

t
    Test integrity of archive.

d
    Delete files from archive.

rn
    Rename files in archive.

mparameters
    Set compression Method.
Examples: -m0=LZMA2 -mx=9 -mfb=64

-ppassword
    Specify password.

-odirectory
    Set output directory.

-r
    Recurse subdirectories.

-y
    Assume Yes on all queries.

-si
    Read data from stdin

-so
    Write data to stdout

DESCRIPTION

The 7zr command is a lightweight, standalone version of 7-Zip designed for systems with limited resources or when only basic archive functionalities are required. It supports a subset of the 7-Zip archive formats, primarily 7z, zip, gzip, bzip2, xz, and tar. 7zr allows users to create, extract, and list the contents of archives.
Unlike the full 7-Zip package, it typically includes only the command-line executable and necessary codecs, reducing its footprint. This makes it suitable for embedded systems, recovery environments, and situations where a minimal archiving solution is preferred. 7zr excels in scripting scenarios, offering a straightforward command-line interface for automated archive management.

CAVEATS

7zr supports a reduced set of features compared to the full 7-Zip application. Some advanced compression methods or archive formats might not be available.

EXAMPLES

Create a 7z archive: 7zr a archive.7z files*
Extract a 7z archive: 7zr x archive.7z
List contents of a 7z archive: 7zr l archive.7z

HISTORY

7zr was created as a lightweight alternative to the full 7-Zip package, focusing on providing essential archiving functionalities in a smaller and more portable format. It is particularly useful in environments where disk space or system resources are limited, or when a simple command-line interface is sufficient. It has seen usage in rescue disks, embedded systems, and automated scripting environments. Development continues to maintain compatibility with common archive formats and provide a stable archiving solution.

SEE ALSO

7z(1), gzip(1), bzip2(1), tar(1)

Copied to clipboard