Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the copy-the-code domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pb-seo-friendly-images domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the johannes domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121
Top 10 du commands in Linux - PC✗3
Top 10 du commands in Linux

Top 10 du commands in Linux

Here are my top 10 du commands with examples:

Disk usage for all files in dir

This is the most basic usage of the du command:

du /path/to/folder
du1 - Top 10 du commands in Linux

Human Readable format

By default du command prints size in Disk Blocks, to use human-readable format (KB, MB, GB, etc.) use the -h or –human-readable argument.

du -h /path/to/folder
du2 - Top 10 du commands in Linux

Total size of folder

Use -s or –summarize to display only a total for each argument:

du -sh /path/to/folder
du3 - Top 10 du commands in Linux

No disk usage for subfolders

print the total for a directory

du --max-depth 1

or

du -d 1
du4 - Top 10 du commands in Linux

Sort by modification date

Show time of the last modification of any file in the directory, or any of its subdirectories

du -ha --time /path/to/folder
du5 - Top 10 du commands in Linux

Sort by size

du -d 1 | sort -n -r
du6 - Top 10 du commands in Linux

Top 5 files/folders by disk size

du -a /path/to/folder | sort -n -r | head -n 5
du7 - Top 10 du commands in Linux

Top 5 files by disk size

find /path/to/folder -type f -printf "%s %p\n" | sort -rn | head -n 5
du8 - Top 10 du commands in Linux

Exclude .txt files

du -ah --exclude="*.txt" /path/to/folder
du9 - Top 10 du commands in Linux
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.