ls -ltr command in UNIX and Linux - Behaviour

5,391

That's the number of blocks used on the filesystem. The info utility on GNU/Linux machines will explain it in more detail. Run

info coreutils ls

I can only assume that your UNIX provides something similiar. To get a more human readable output run

ls -ltrh

Thus I presume that your GNU/Linux and UNIX machine use different blocksizes on their fs.

Share:
5,391

Related videos on Youtube

ahairshi
Author by

ahairshi

Updated on September 18, 2022

Comments

  • ahairshi
    ahairshi almost 2 years

    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
    
  • ahairshi
    ahairshi about 9 years
    Any way to compare the files (just count) of two different Environment? I can run a script on both servers to find the count, and compare.
  • bjanssen
    bjanssen about 9 years
    You need to be more specific.
  • ahairshi
    ahairshi about 9 years
    In the example I provided, there are five files under /A/B/C/ in both Unix and server. I have other directories under A, and B. I need to check the number of files in both unix and linux servers.
  • bjanssen
    bjanssen about 9 years
    I have no clue, what Unix means to you. But to count the files in a directory under GNU/Linux run ls | wc -l. If you need subdirectories too, try find . -type f | wc -l.