List archive contents without extracting.
tar -tf backup.tar.gzCreate or inspect tar archives. This example lists files without extracting them.
tar MODE [OPTION]... ARCHIVE [FILE]...List archive contents without extracting.
tar -tf backup.tar.gzCreate a gzip-compressed archive of a project directory.
tar -czf site-backup.tar.gz -C ./project .| Option / clause | Description |
|---|---|
-c, --create | Create a new archive. |
-x, --extract | Extract files from an archive. |
-t, --list | List archive contents without extracting. |
-f, --file=ARCHIVE | Use the specified archive file. |
-z, --gzip | Filter the archive through gzip. |
-J, --xz | Filter the archive through xz. |
-C DIR | Change to DIR before processing files. |
-v, --verbose | List processed files. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.