List the contents of a tar or tar.gz file
Q. How do I list the contents of a tar or tar.gz file?
A. GNU/tar is an archiving program designed to store and extract files from an archive file known as a tarfile. You can create a tar file or compressed tar file tar. However sometime you need to list the contents of a tar or tar.gz file on screen before extracting the all files.
Task: List the contents of a tar file
Use the following command:
$ tar -tvf file.tar
Task: List the contents of a tar.gz file
Use the following command:
$ tar -ztvf file.tar.gz
Task: List the contents of a tar.bz2 file
Use the following command:
$ tar -jtvf file.tar.bz2
Where,
- t: List the contents of an archive
- v: Verbosely list files processed (display detailed information)
- z: Filter the archive through gzip so that we can open compressed (decompress) .gz tar file
- j: Filter archive through bzip2, use to decompress .bz2 files.
- f filename: Use archive file called filename
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Solaris UNIX tape backup and recovery with tar and cpio command
- Find files by access, modification date under Linux or UNIX
- Howto: Display list of modules or device drivers in the Linux Kernel
- UNIX / Linux Decompress tgz / tar.gz Files
- Linux / UNIX: Delete a file
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: command tar, file tar, gnu tar, gz file, gzip, list contents of tar file, list files in a tar, list files in tar, list files in tar archive, list files in tar gz, tar bz2, tar file, tar list file, tar list of files



Recent Comments
Today ~ 32 Comments
Yesterday ~ 1 Comment
Yesterday ~ 3 Comments
Yesterday ~ 2 Comments
Yesterday ~ 3 Comments