[Linux] du-View folder size-and sort by size

Source: Internet
Author: User

reference:http://blog.csdn.net/jiaobuchong/article/details/50272761#

One day, I want to check the use of computer hard disk, as a command control, nonsense, start it:

Use the DF command to view the current disk usage:

[Email protected]:~$ df-lh  Filesystem      Size  used Avail use% mounted on  /dev/sda3        18G  5.7G   11G  35%/  udev            2.7G  4.0K  2.7G   1%/dev  tmpfs           553M  916K  552M   1%/run  none            5.0M     0  5.0M   0%/run/lock  None            2.7G  488K  2.7G   1%/run/shm  /dev/sda2       946M  128M  754M  15%/boot  /dev/sda1        93G   87G  5.5G  

The following du command is on the pitch:

[Email protected]:~$ pwd  /home/jack  [email protected]:~$ du-sh   1.9G    .  [Email protected]:~$ cd  . [Email protected]:/home$ du-sh jack/  1.9G    jack/  [email protected]:/home$  du-h--max-depth=0 jack/ 1.9G    jack/  

You can see the same results from the top,

-S,--summarize display only a totals for each argument,-s The function of this parameter is to display only the total, that is, the size of the current folder.

[Email protected]:~$ du-sh *  170M    Desktop  452K    Documents  161M    Downloads  12K Examples.desktop  833M    installed-software  284K    learngit  4.0K    Music  4.7M    Pictures  3.2M    program_pratice  4.0K    public  112K    session  4.0K    Templates  4.0K    Videos  

* The size of all the files in the current directory can be listed. Do you want to sort the listed files in a large-to-small way?

[Email protected]:~$ du-sh * | Sort-nr  833M    installed-software  452K    Documents  284K    learngit  170M    Desktop  161M    Downloads  112K    session  12K examples.desktop  4.7M    Pictures  4.0K    Videos  4.0K    Templates  4.0K    public  4.0K    Music  3.2M    

Just find the sort to do a favor. Oh! This sort of is not normal, all because of the reason of the-h parameter,

[Email protected]:~$ du-s * | Sort-nr   852756  installed-software  173868  Desktop  164768  Downloads  4724    Pictures  3236    program_pratice  452 Documents  284 learngit  Examples.desktop  4   Videos  4   Templates  4   public  4   Music  

This is the normal sort.

Du-s * | Sort-nr | Head selects the 10 rows in the front,

Du-s * | Sort-nr | Tail the 10 rows in the back.

[Linux] du-View folder size-and sort by size

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.