Linux – Disk Utilization [ du ]

Background

Let us quickly discuss using “Disk Utilization“, du, to list disk utilization on a Linux System.

BTW, we will be targeting folder level information.

Options

Tabulated

Option Option Short Form Option Long Form Sample
Human Readable -h –human-readable K – Kilobytes
M – Megabytes
G – Gigabytes
T – Terabytes
Total -c –total du –total
Summarize -s –summarize du -s
du –summarize

Sample

Human Readable

Command


du -h *  2>/dev/null

Output

Total

Objective

  1. List sizes for the following folders and at the tail end list aggregated size, as well
    • db2inst1/sqllib/acs
    • db2inst1/sqllib/db2tss

Command


du -c db2inst1/sqllib/acs db2inst1/sqllib/db2tss 2>/dev/null | more

Output

Summarize

Summarize for specific folders

Objective
  1. Summarize sized for the following folders
    • db2inst1/sqllib/acs
    • db2inst1/sqllib/db2tss
Command

du -s db2inst1/sqllib/acs db2inst1/sqllib/db2tss 2>/dev/null | more

Output

Summarize for all folders

Objective
  1. Summarize all sub-folders
Command

du -s * 2>/dev/null | more

Output

Summarize for all folders and Ordered

Objective
  1. Summarize all sub-folders
  2. And, order the results
Command

du -s * 2>/dev/null | sort -nr

Output

References

  1. Lifewire
    • How To Find How Much Disk Space A File Or Folder Uses In Linux
      Link
  2. Stack Exchange
    • Listing directories based on size from largest to smallest on single line
      Link

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s