LinuxCommandLibrary

atool

Extract, list, create, and check archive files

TLDR

List files in an archive

$ atool [[-l|--list]] [path/to/archive.zip]
copy

Extract an archive (safely creates a subdirectory if needed)
$ atool [[-x|--extract]] [archive.tar.gz]
copy

Extract an archive to a specific directory
$ atool [[-X|--extract-to]] [path/to/output_directory] [archive.rar]
copy

Display a specific file's content from an archive to standard output (like cat)
$ atool [[-c|--cat]] [archive.tar] [path/to/file_in_archive.txt]
copy

Create a new archive from specified files and/or directories
$ atool [[-a|--add]] [new_archive.zip] [path/to/file1 path/to/file2 ...]
copy

List files in an archive and send the output through a pager
$ atool [[-l|--list]] [[-p|--pager]] [large_archive.tar.bz2]
copy

Extract multiple archives at once (each to its own subdirectory if needed)
$ atool [[-x|--extract]] [[-e|--each]] [archive1.zip] [archive2.tar.gz] [*.rar]
copy

Repack an archive from one format to another (e.g., .tar.gz to .tar.7z)
$ atool [[-r|--repack]] [old_archive.tar.gz] [new_archive.tar.7z]
copy

SYNOPSIS

atool [OPERATION] [OPTIONS] archive_file [files...]

Examples:
atool -x archive.tar.gz
atool -l archive.zip
atool -c new_archive.zip file1 file2 directory/
atool -t archive.rar

PARAMETERS

-x, --extract
    Extracts the contents of the specified archive file.

-l, --list
    Lists the contents of the archive without extracting.

-c, --create
    Creates a new archive from the specified files or directories.

-t, --test
    Tests the integrity of the archive file.

-a, --add
    Adds files to an existing archive (support depends on format).

-d, --delete
    Deletes files from an existing archive (support depends on format).

-O, --output-directory=


    Specifies the directory where archive contents should be extracted.

-k, --keep
    When extracting, keeps partially extracted or broken files.

-F, --force
    Forces overwrite of existing files without prompting during extraction.

-v, --verbose
    Provides more detailed output during operations.

-q, --quiet
    Suppresses most output, useful for scripting.

-h, --help
    Displays a help message with command usage and options.

DESCRIPTION

atool is a powerful command-line utility designed to simplify archive management on Linux systems. Acting as a front-end wrapper, it provides a unified interface for handling various archive formats such as .zip, .tar, .gz, .bz2, .xz, .rar, .7z, and more.

Instead of requiring users to remember specific commands and options for different archive tools (like tar, unzip, or unrar), atool automatically detects the archive type and invokes the correct underlying utility. This makes common operations like extracting, listing, creating, and testing archives significantly easier and more consistent. It abstracts away the complexity, allowing users to perform operations with a single, intuitive set of commands. atool streamlines workflow for anyone frequently dealing with compressed files.

CAVEATS

atool depends on the presence of the underlying archive utilities (e.g., tar, unzip, unrar) on the system. If a specific archiver is missing, atool will not be able to handle its corresponding format.

Some operations, such as adding or deleting files from an archive, are not universally supported across all formats (e.g., adding to .gz is not possible). Performance might have a slight overhead compared to direct calls to native tools, but this is usually negligible.

AUTOMATIC FORMAT DETECTION

atool intelligently identifies the archive format based on its file extension or internal signatures, ensuring the correct underlying utility is invoked without manual specification by the user. This is one of its primary strengths, simplifying archive operations significantly.

INTERACTIVE MODE

For certain operations, such as extracting password-protected archives or dealing with conflicts, atool may prompt the user for necessary input (e.g., passwords or overwrite confirmation), providing a user-friendly interactive experience.

HISTORY

atool is part of the atool package (originally associated with `apack`), developed by Oskar Skoog. It was created to provide a simpler, more intuitive, and unified command-line interface for handling various archive formats, reducing the need for users to memorize numerous command-line flags and tool-specific syntax for different archiving utilities. Its design emphasizes convenience and automatic format detection, contributing to its popularity among Linux users seeking streamlined archive management.

SEE ALSO

tar(1), zip(1), unzip(1), rar(1), unrar(1), 7z(1), gzip(1), bzip2(1), xz(1)

Copied to clipboard