When you type in
ls -l, there is a number on the first line labeled "
total 22037"? What does this number mean? I am attempting to write my own version of
ls -l( in C), and how do I get this value or calculate it?
Thanks for any help.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
To implement standard UNIX command, you should check POSIX, e.g. at http://pubs.opengroup.org/onlinepubs/9699919799/. For
ls command: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html you will find the format of output:
If any of the -l, -n, -s, -g, or -o options is specified, each list of files within the directory shall be preceded by a status line indicating the number of file system blocks occupied by files in the directory in 512-byte units if the -k option is not specified, or 1024-byte units if the -k option is specified, rounded up to the next integral number of units, if necessary. In the POSIX locale, the format shall be: