![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to determine if a file is done copying | husker_ricky | UNIX for Advanced & Expert Users | 2 | 05-22-2008 08:32 AM |
| determine the physical size of the hard disk | hoffies | HP-UX | 4 | 11-15-2007 01:08 AM |
| command to find out total size of a specific file size (spread over the server) | abhinov | SUN Solaris | 3 | 08-08-2007 03:48 AM |
| How to determine the max file size | dknight | UNIX for Advanced & Expert Users | 2 | 10-27-2006 05:39 AM |
| How to determine if a File is Open? | derrikw2 | UNIX for Advanced & Expert Users | 2 | 02-01-2002 07:30 AM |
|
|
LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
alan,
Your file is listed in bytes. the smallest measurement of data commonly used. If you remember or know anything of metric system: Kilo ...=1000 bytes mega =1000 kilo giga ..=1000 mega tera ..=1000 giga If you want to experiment use the "prealloc" command. This will allow you to create files of any size allowed by your filesystem or OS. prealloc <filename> <size>
__________________
My brain is your brain |
|
||||
|
Hi,
Don't be afraid to ask... first always try the "man" command, it will teach you a lot... use it with "man command"... Now, to answer to your question, and straight from the man page of ls command... Quote:
|
|
||||
|
Re: determine the size of a file???
Quote:
Thanks to all of you for your replies. This helps me a great deal!! Thank you. |
|
||||
|
Things are not quite this simple. There are two different concepts of size here.
The 1558 does mean that a program can read 1558 bytes from this files. An attempt to read byte 1559 will fail with an EOF being returned. This is one concept of size. But I think that Alan is actually interested in the second concept which is how much disk space is consumed by the file. The answer is that 8 * 512 = 4096 bytes of disk space is being using by this file. And that 8 came from the first column of the "ls" listing. So if a program adds a byte to the file, making that 1558 to be a 1559, no additional disk space is needed. This difference becomes very important because unix supports sparce files. If Alan wrote a program that seeks to byte 1,999,999,999 and writes a single byte, he will see something like this: 16 -rwx------ 1 root sys 2000000000 Dec 30 14:06 sparsefile (Hmmmm... I would have predicted 8. Apparently a full block was allocated instead of a fragment. This was on HP-UX 11.00 on a vxfs filesystem.) Database programs like Oracle will do this so it happens more often than you may think. Here is my program in case you'd like to try it... Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
main()
{
int fd;
char byte=0;
fd=open("sparsefile", O_CREAT|O_RDRW, 0700);
lseek(fd, 1999999999, SEEK_SET);
write(fd, &byte, 1);
close(fd);
exit(0);
}
|
|
|||
|
but when you brake it down to its essentials its still
1 byte = 8 bits. 1kb = 1024 bytes 1mb = 1024 kb 1gb = 1024 mb and so on. your 512 blocks and what not are parts of the way the fs is formated. on aix and solaris when you do are defing the space for a fs you have to do it in 8byte chunks (i believe is the smalles piece you can chunk by.) its all multiples of 8. if your talking about how many blocks you are useing on the disk then you would have to look at the way the fs was formated. |
|||
| Google UNIX.COM |