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 the Unix tar zip command?
- How do I use the Unix tar xzvf command?
- How do I use the Unix tar xvf command to extract files?
- How do I use the Unix tar xvf command?
- How do I extract files from a tar archive using the command line?
- How do I use tar commands with xz?
- How do I use the command line to tar and zip a file?
- How do I extract files from a tar archive using the cmd command?
- How do I use tar gzip with a password?
- How do I use gzip, tar, and unzip to compress files?
See more codes...