how to know size of a file

Davide Brini dbrini at
Tue Jul 1 03:29:59 PDT 2003

On Tue, 1 Jul 2003 01:12:23 -0700 (PDT)
layman <layman82 at> wrote:
> how do i store it directly in a variable (bash), 

SIZE=`<any command that gets the file size, eg one of those mentioned>`

BTW, the size returned by du -sh <filename> may differ slightly from the
one reported by ls -l (or | wc -c), expecially for small files.
Furthermore, du -sh returns data in "human readable" form, eg "10K", "20M"
and so on. If you want the number in bytes, use du -sb instead (but
consider what I said before - the size reported may differ).

Unsubscribe: send email to listar at
and put 'unsubscribe blfs-support' in the subject header of the message

More information about the blfs-support mailing list