≡ Menu

tar file

Linux: tar Extract Files

How can I extract or uncompress a file from tar ball downloaded from the Internet under Linux using bash command prompt?
[click to continue…]

Q. How do I extract a single file or directory form a tarball under UNIX / Linux shell prompt? How do I restore a single file from /dev/st0 tape device?
[click to continue…]

Q. I've download ed .tbz file. How do I open .tbz file under Linux / UNIX operating system using a shell prompt or GUI application?
[click to continue…]

List The Contents Of a tar.bz2 Tarball File

How do I list the contents of a tar.bz2 file under Linux or UNIX-linke operating systems using a shell prompt?
[click to continue…]

How do I create a tar file under Linux using command line options?
[click to continue…]

We have recently brought a new Sun Solaris UNIX server. How do I Backup data and make a recovery for the Solaris OS using tar and tape device?
[click to continue…]

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