show_directories_with_sizes

This is an old revision of the document!


Show Directories with Sizes

Feb 2025


Introduction

When we list directories, we generally just get permissions and dates of a directory, but sometimes, especially when we are trying to track down large directories that are consuming space, we want to list those directories with their file sizes.


LIst Directories with Size

This is very simple to do, just use the following command:

  du -sh *

If you are in the root, you will see all the top level folders and subfolders, or you can run this from a specific folder and just see the subfolders there.

0       bin
225M    boot
0       dev
27M     etc
72K     home
0       lib
0       lib64
16K     lost+found
4.0K    media
4.0K    mnt
4.0G    opt
0       proc
5.5M    root
13G     run
0       sbin
4.0K    srv
0       sys
28K     tmp
2.1G    usr
32G     var

In the above example, we can see a listing of folders from the root, along with their folder sizes.


show_directories_with_sizes.1740758693.txt.gz · Last modified: by walkeradmin