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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to get the size of tar,Z,gz type file.
# 1  
Old 03-04-2009
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 Smilie

Regards,
Kalai
# 2  
Old 03-04-2009
ls -l file.gz |awk '{print $5}'

Or

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

Same for .Z .tar or any other ordinary file.
# 3  
Old 03-04-2009

You can get the size of any file with:

Code:
wc -c FILENAME

If you want to get the uncompressed size:

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

# 4  
Old 03-04-2009
Thanks a lot Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX command to check if file name ends with .tar OR if the file is a tar file

Hello Team, Would you please help me with a UNIX command that would check if file is a tar file. if we dont have that , can you help me with UNIX command that would check if file ends with .tar Thanks in advance. (10 Replies)
Discussion started by: sanjaydubey2006
10 Replies

2. Shell Programming and Scripting

Compress a tar file to smaller size

I have a tar file with name DTT012_GP_20140207.tar and many more with different names of different sizes ranging from 1GB to 4GB. Now my requirement is to extract/not extract these files and then divide it into various parts of size 500MB and save it with different names and then compress... (5 Replies)
Discussion started by: Shaibal_bp
5 Replies

3. UNIX for Dummies Questions & Answers

Increase Font size for text to type in CYGWIN

Please mention "How to increase font size for text to type commands in CYGWIN " ? (2 Replies)
Discussion started by: adirajup
2 Replies

4. UNIX for Dummies Questions & Answers

Using squid to block downloads by size and file type

Can someone tell me how I can use squid to block downloads by certain file types and/or by download size. I want to block people from downloading files of certain type e.g .mp3 and also files of sizes above 30MB. (1 Reply)
Discussion started by: bryanmuts2000
1 Replies

5. UNIX for Dummies Questions & Answers

Print folder size ordered by pattern value of specific file type :-) ! challenge !

Hello dear unix command line friends ! I'm looking for a simple combinaison of ls & awk (maybe grep) to print: list of folders of a directory |_ ordered by size like what I have with $ du -sk ./* | sort -rn printing that result: 8651520 ./New Virtual Machine_1 8389120 ./Redhat ... (1 Reply)
Discussion started by: holister
1 Replies

6. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

7. UNIX for Advanced & Expert Users

how to modify font size and type from script

I need to print different lines in different font types and sizes to the terminal window from csh script. I can easily change font color and print characters in bold or underline, but cannot figure out a way to change font. Any help is greatly appreciated.:confused: (3 Replies)
Discussion started by: helido
3 Replies

8. UNIX for Dummies Questions & Answers

maximum tar file size?

Is there a reasonable maximum limit for tar file sizes? I want to transfer a pile of files from one server to another but have restricted means, so tarring them first will probably be best... but how big can I go - both for the file format itself and for the operating system (linux) to handle? ... (7 Replies)
Discussion started by: Bobby
7 Replies

9. Shell Programming and Scripting

Size limitation in Tar command

Hi to every body there, I am new this forum and this is my first post. I am a new user of Unix, is there any size limitation of files while creating tar file. Thanks in advance (4 Replies)
Discussion started by: Manvar Khan
4 Replies

10. UNIX for Dummies Questions & Answers

tar file size (volume) limiting

Hi I am trying to create tar files of a whole bunch of files and want to limit them to 50Mb each. I have tried using the -k option but cannot get it to work. Has anyone out there had success creating these? Cheers Ian (1 Reply)
Discussion started by: bigjeff
1 Replies
Login or Register to Ask a Question