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.
Related videos on Youtube
Author by
ahairshi
Updated on September 18, 2022Comments
-
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 about 9 yearsAny 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 about 9 yearsYou need to be more specific.
-
ahairshi about 9 yearsIn 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 about 9 yearsI 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, tryfind . -type f | wc -l
.