How to get the size of tar,Z,gz type file.

Hi,

How to get the size of the
.tar file
.Z file
.gz file.

Please help me what command i need to use in shell scripting :frowning:

Regards,
Kalai

ls -l file.gz |awk '{print $5}'

Or

wc -c file.gz |awk '{print $1}'

Same for .Z .tar or any other ordinary file.

You can get the size of any file with:

wc -c FILENAME

If you want to get the uncompressed size:

unzip -p FILE.zip | wd -c
uncompress -c FILE.Z | wc -c
gunzip -c FILE.gz | wc -c 

Thanks a lot :slight_smile: