cli-tarHow can I view the contents of a Unix tar file?
To view the contents of a Unix tar file, you can use the tar command with the tvf option. This command will list the contents of the tar file without extracting it. The general syntax is as follows:
tar tvf <filename>.tar
The output of the command will be a list of the contents of the tar file, including the file name, permissions, owner, size, and timestamp.
The following example code shows the output of the command for a tar file named example.tar:
$ tar tvf example.tar
-rw-r--r-- me/users 0 2019-10-20 15:20 file1.txt
-rw-r--r-- me/users 0 2019-10-20 15:20 file2.txt
-rw-r--r-- me/users 0 2019-10-20 15:20 file3.txt
The parts of the command are as follows:
tar: The tar command is used to create, modify, and extract files from a tar archive.tvf: This option is used to view the contents of a tar file.<filename>.tar: This is the name of the tar file.
Helpful links
More of Cli Tar
- How do I use tar gzip to compress files at a specific level?
- How do I use the command line to tar and zip files?
- How can I use tar commands to zip a file?
- How do I use the shell to tar and zip files?
- How do I use gzip, tar, and zip to compress files?
- How can I use a single command to tar and gzip a file?
- How do I remove a file from a Unix tar archive?
- How can I tar and gzip a file in one command?
- How do I extract a tar file with gzip?
- How do I use the command line to tar and zip a file?
See more codes...