Show tar files sizes

21

I've got a bad backup script including an unwanted file. The .tar.gz backup file is 5gig big and I'd like to get a list of every file in the archive and their size.

Is that possible ? How would you do it ?

Frederic Morin

Posted 2009-10-06T21:02:42.447

Reputation: 353

Answers

22

This should list all files and detailed information about them:

tar -ztvf somefile.tar.gz

John T

Posted 2009-10-06T21:02:42.447

Reputation: 149 037

1-t (list) and -v (verbose, like ls -l use a long listing format) – ThorSummoner – 2018-04-09T21:42:05.977

-z isn't strictly needed, for a .tgz file just using -tvf was enough. – That Brazilian Guy – 2019-07-08T14:25:17.483

4

Use

tar --list --verbose --gunzip --file backup.tar.gz > backup_list.txt

to create a file containing a list of all the files in your archive.

You can then grep foo backup_list.txt to find things, or edit, sed, cut, view, etc.

DaveParillo

Posted 2009-10-06T21:02:42.447

Reputation: 13 402