Search code examples
linuxunixls

ls -ltr command in UNIX and Linux - Behaviour


Why does ls -ltr show different total? We have same files in both unix and linux environment please refer BELOW

UNIX

> ls -ltr /A/B/C/
total 2140
-rwxr--r--   1 demo     demo       14415 May 30  2007 A.jar
-rwxr--r--   1 demo     demo       11445 May 30  2007 B.jar
-rwxr--r--   1 demo     demo       13443 May 30  2007 C.cab
-rwxr--r--   1 demo     demo      614429 May 30  2007 D.jar
-rwxr--r--   1 demo     demo      384763 May 30  2007 E.cab

LINUX

> ls -ltr /A/B/C/
total 1024
-rwxr--r--   1 demo     demo       14415 May 30  2007 A.jar
-rwxr--r--   1 demo     demo       11445 May 30  2007 B.jar
-rwxr--r--   1 demo     demo       13443 May 30  2007 C.cab
-rwxr--r--   1 demo     demo      614429 May 30  2007 D.jar
-rwxr--r--   1 demo     demo      384763 May 30  2007 E.cab

PS : I posted the same in superuser, but the view count is very low.. So I am posting here

https://superuser.com/questions/898306/ls-ltr-command-in-unix-and-linux-behaviour


Solution

  • It's because of different filesystems. Total shows how many blocks used by files. Add -s and you will see (ls -ltrs)