Tar

    Extract specific file

    tar xvf tarball.tar path/to/file
    

    source

    Extract into a directory

    tar xvf tarball.tar -C dest_dir
    

    Flat extraction (remove first directory)

    tar xvf tarball.tar --strip-components=1
    

    Search a file

    tar tf archive.tar | grep file
    

    Search if a string is present into files of multiple archives

    find . -name \*.tar.gz -print0 | xargs -0 zgrep "STRING"
    

    source

    Total size if uncompressed

    zcat archive.tar.gz | wc -c
    
    # or faster and more verbose on multiple archives
    gzip -l *.tar.gz
    

    source

    Original size of a file (with no unzip)

    tar ztvf archive.tar.gz -v --wildcards '*file.txt'
    

    Check content on the fly (stdout extract)

    tar xvf archive.tar.gz -O | grep "pattern"
    

    source