Search code examples
linuxshellarchivetar

List the contents of multiple .tar archive files


To list the content of one .tar archive file I use

tar -tvf archive.tar

and I was hoping to use similar format to list the contents from more files, but

tar -tvf *.tar

is not working as I expected.

What is the best one line solution to list the contents of multiple .tar archive files?


Solution

  • does this help?

    for f in *.tar 
    do 
        echo "content of $f:"
        tar tvf "$f"
    done