sh script code to get file size.

Robert Bonomi bonomi at mail.r-bonomi.com
Sat Jan 19 03:34:07 UTC 2013


> From owner-freebsd-questions at freebsd.org  Fri Jan 18 17:30:31 2013
> Date: Fri, 18 Jan 2013 18:26:54 -0500
> From: Fbsd8 <fbsd8 at a1poweruser.com>
> To: FreeBSD questions <questions at freebsd.org>
> Subject: sh script code to get file size.
>
> In a script in am working on I need to find out the allocated
> size of a sparse file.
> The only command that comes to mind is "ls -lh"
> The "du -h" command is not appropriate because it will show
> the occupied size and not the allocated size.
>
> I don't know how to parse out to the position in the output of that
> "ls -lh" command to pickup the file size value.

   ls -lh  procmail.log |awk '{print $5}'


More information about the freebsd-questions mailing list