How to list and sort directories and files by size in Linux

0

This will list all directories at the root level sorted alphabetically with their size printed in an easy to read format

du -sh /*

To list all subdirectories for a specified parent directory, use this command and specify the parent directory path like “usr” in this example.

du -h –max-depth=1 /usr

or run this in for current directory

du -h –max-depth=1 2>/dev/null

List size of files within a directory

ls -s

Posted in: Linux
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

*




You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">