ahairshi
ahairshi

Reputation: 381

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

Upvotes: 0

Views: 1629

Answers (2)

Aman Chourasiya
Aman Chourasiya

Reputation: 1238

Total only indicates the total count of blocks taken by the directory.And the block size may vary that is why "ls -ltr " is showing different results.

Upvotes: 1

Sergius
Sergius

Reputation: 986

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

Upvotes: 3

Related Questions