In Linux, the ls-l command displays the meaning of total. __linux

Source: Internet
Author: User

When you use the LL or ls-l command to view the details of a file in Linux, you will see the following words on the first line:

Total 20
Drwxr-xr-x 8 User Rnd 134 APR 27 04:40./
Drwxr-xr-x 6 User Rnd Apr 27 07:56. /
Drwxr-xr-x 8 User rnd 4096 May 3 08:13. git/
-rw-r--r--1 user rnd 1374 APR 04:40. Gitignore
-rw-r--r--1 user rnd 2710 APR 04:40 Info
Drwxr-xr-x 3 User rnd APR 04:40 platform/
-rw-r--r--1 User Rnd 163 APR 04:40 Project
Drwxr-xr-x 4 user rnd Apr 04:40 testsupport/
Drwxr-xr-x 7 user rnd 4096 APR 04:40 utils/

So what does total 20 mean?

First of all, to understand the concept of a block, Linux data storage is in blocks. block, can be understood as a fixed container, or image point, understanding for our daily life to take the elevator, the elevator's load-bearing size is block size. At this point, we think of the current directory of files (including folders, notice the concept of all files under Linux) as an orderly ride in the elevator, but the weight of different people.

Next, first of all to inquire about the current lift load capacity, we can use the following command query:

$ getconf PAGESIZE

My system gets a value of 4096, which is 4K.
So our elevator load is 4096, and then we start to see how Total 20 is coming, which is the process of simulating passengers ' ride in elevators.
First trip: The first name is. Passengers, weight is 134b, he went into the elevator, the elevator is not overweight, continue to enter the person; the second name is. Passengers, weight is 59b, after entering, still not overweight, continue to enter; the third named. Git's passenger, weighing 4096, went in and the elevator alarm was overweight, so he quit the elevator.

Because the order of the passengers can not be changed, so when the number 3rd out of the elevator, although the elevator has a lot of spare space, but also do not allow the number of people behind the 3rd into the elevator, so the first elevator, only a load of 1 and 22 people.
Second trip:

The weight of the number 3rd is 4096, just reached the upper limit of the elevator city, so the second trip only planted 3rd.

The third time: The fourth passenger is called. Gitignore, his weight is 1374, after entering the elevator, the elevator still has spare load, the name of info 5th passengers, weight is 2710, when he went in, the elevator did not alarm, at this time, the elevator has been carrying 1374+2710=4084. The sixth passenger name is Plateform, the weight is 18b, when he goes in, the lift carries the weight to reach 4102, the overload, therefore 6th exits.

So the third elevator carried 4th and 5th, two people.
Journey Four:

The same method, can be obtained, the fourth trip to 6,7,8 three people.

Journey Five:

Just like the second trip, it was a full load of a man on the first trip.

In summary, the elevator transport 5 times, we already know that the elevator every trip to the size of the load-bearing capacity is 4K, so 5 trip total load-bearing capacity is 4k*5=20k. We can think of load capacity as a resource, and total means that all the files in the list are occupied by the sum of the disk space, which is the sum of the resources, and the unit of statistics is KB.
Thus, this is the origin of total (Kb).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.