• No related posts.

      • No related posts.

        • No related posts.

          • No related posts.

              No related posts.

            How to sort folders by size with one command line in Linux

            du –max-depth=1 $PWD | sort -n -r
            du -H –max-depth=1 $PWD

            “-H” – produce human readable format sizes (like: 1K 10M 1G)

            A good and short one liner using xargs

            du -s ./* | sort -n| cut -f 2-|xargs -i du -sh {}

            This will sort the folders according to size and display them in human readable format… to reverse the list
            use sort -nr option.

            Related posts:

            1. Sending image emails with mutt from command line
            2. IOP vmstat pidstat
            3. Perl script to read .dbx files
            This entry was posted in Centos, Debian, Fedora, Linux, Redhat, Ubuntu and tagged , , , , , , , .

            Leave a Reply