LinuxCommandLibrary

ptargrep

Search for patterns inside tar archives

TLDR

Search in tar archive

$ ptargrep [pattern] [archive.tar]
copy
Case insensitive
$ ptargrep -i [pattern] [archive.tar.gz]
copy
List matching files
$ ptargrep -l [pattern] [archive.tar]
copy
Search gzipped archive
$ ptargrep [pattern] [archive.tar.gz]
copy
Search bzip2 archive
$ ptargrep [pattern] [archive.tar.bz2]
copy
Extract matching files
$ ptargrep --extract [pattern] [archive.tar]
copy

SYNOPSIS

ptargrep [-i] [-l] [--extract] pattern archives

DESCRIPTION

ptargrep searches for patterns within tar archives. It examines file contents without full extraction.
Compressed archives are handled automatically. Gzip, bzip2, and xz compression supported.
Pattern matching uses Perl regular expressions. Full regex power is available.
List mode shows which files match. Useful for identifying relevant files.
Extract mode pulls matching files. Only files containing the pattern are extracted.

PARAMETERS

-i, --ignore-case

Case insensitive matching.
-l, --list-only
List matching files only.
--extract
Extract matching files.
--basename
Match against basename.
--help
Show help.

CAVEATS

Part of Perl distribution. Large archives may be slow. Memory usage with large files.

HISTORY

ptargrep is distributed with Perl's Archive::Tar module. It provides grep-like functionality for archived content.

SEE ALSO

zgrep(1), tar(1), grep(1), perl(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community