List the contents of a tar or tar.gz file

List the contents of a tar or tar.gz file

To list the contents of a tar or tar.gz file, you can use the tar command and the -tf option.

For example, to list the contents of a tar file named myfile.tar, you can use the following command:

tar -tf myfile.tar
Source:w‮uttual.ww‬ri.com

To list the contents of a tar.gz file, you can use the same command, but specify the .tar.gz file as the argument. For example:

tar -tf myfile.tar.gz

This will list the contents of the tar or tar.gz file, including all directories and files contained within the archive.

You can also use the -z option to specify that the file is a tar.gz file, as follows:

tar -tzf myfile.tar.gz

This will list the contents of the tar.gz file, including all directories and files contained within the archive.

If you want to see the contents of a tar or tar.gz file in a more human-readable format, you can use the --list option instead of -tf or -tzf. For example:

tar --list --file myfile.tar.gz

This will list the contents of the tar.gz file in a more readable format, including the file sizes and modification dates.

Created Time:2017-10-30 10:17:49  Author:lautturi