how to use "size" command???


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to use "size" command???
# 1  
Old 01-23-2009
Bug how to use "size" command???

hello sir,
I am trying to use the size command.I typed :-
Quote:

$size hello.txt
It says that the format is not compatible.I am getting this error for any input file to this size command.I tried using the "-A" and "-B" options but still I couldnt solve it.
Can you please tell me the format of txt files.And how to use size command for various formats like .c,.tar,etc.......
# 2  
Old 01-23-2009
The size command is for object files, not text files, according to the man pages.
# 3  
Old 01-23-2009
size(1) isn't what the name implies, it's part of Binutils and shows the size of the various data sections of a binary object (executable, library, or otherwise)
To get the disk size of a regular file use "ls -l" or du(1)
# 4  
Old 01-23-2009
according to linux man page:
The size command writes to standard output the number of bytes required by all sections, along with their sum for each XOFF file. If the -f flag is specified, the section name follows
the section size.
For Examples:
Code:
>cc -o socket_serv.o -c socket_serv.c
>ls
socket_serv.o socket_serv.c
>size -f socket_serv.o
sock_serv.o: 576(.text) + 124(.data) + 0(.bss) = 700

# 5  
Old 01-23-2009
Bug !!! comparing SIZES !!!

Hello sir,
I did understand that they are only for object files.
My target was to compare txt files and their corresponding .gz,.z files to show the difference in the size.
I used :-
Quote:
ls -s
But still I am not able to see the difference in blocks.When I did "ls -l" I DISCOVERED that .z,.gz are larger that the .txt file.Can you tell me how to compress them?
# 6  
Old 01-23-2009
wc -c

Try wc -c {filename}
# 7  
Old 01-23-2009
When you compress an already compressed file - or sometimes executable files, the number of bytes in the compressed file is usually more than the original.

try
Code:
gzip -9 filename

and see if that improves compression

Edit: if the starting file is only a few bytes it will also be larger than the original. Compression depends in part on redundant character sequences
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

Retrieve RAM memory size from "top" command output

Hi, I am trying to get the system RAM size from "top" command's output by the following but it is not working. top | sed "s/^Mem.**\(*\), *//" (10 Replies)
Discussion started by: royalibrahim
10 Replies

5. Shell Programming and Scripting

Delete files older than "x" if directory size is greater than "y"

I wrote a script to delete files which are older than "x" days, if the size of the directory is greater than "y" #!/bin/bash du -hs $1 while read SIZE ENTRY do if ; then find $1 -mtime +$2 -exec rm -f {} \; echo "Files older than $2 days deleted" else echo "free Space available"... (4 Replies)
Discussion started by: JamesCarter
4 Replies

6. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

7. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

8. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

9. UNIX for Advanced & Expert Users

Command similar to "touch" for modify File size

Hi All, I'm trying to find a command like similar to "touch" which would let me change the file size property. For ex: I have a file of size 1MB using the command i would like to set/update the size something like 1KB. Is it possible? Is there any such command which would accomplish this... (3 Replies)
Discussion started by: sriharshareddyk
3 Replies

10. UNIX for Dummies Questions & Answers

Maximum input file size in "Diff" Command

Hello, Can anyone let me know what is the maximum file size that can be given as input for the "Diff" Command in Unix? I have a file size as large as 28MB and which can also increase. Will I face any issues with such a file size. If yes, What is the other alternative. Thanks in advance for... (1 Reply)
Discussion started by: Neeraja
1 Replies
Login or Register to Ask a Question