Rank Directory Usage

LinuxBeginner
Practice Now

Introduction

A workspace contains three directories with different amounts of data. Before cleanup, an administrator needs a small report ordered from the least-used directory to the most-used directory.

This challenge uses the du, sort, pipeline, and redirection patterns already practiced in preceding guided labs.

Create the Usage Ranking

Current Situation

The immediate children of /home/labex/project/disk-audit/workspace are cache, logs, and releases. The empty reports directory is ready.

Scope

  • Measure the three immediate directories with human-readable summarized sizes.
  • Sort the measured lines from smallest to largest.
  • Save the complete output in reports/directory-usage.txt.
  • Do not change the prepared data.

Your Goal

Create one size-ordered directory-usage report.

Acceptance Criteria

  • reports/directory-usage.txt contains one du -sh result for each prepared directory.
  • The three lines are ordered by human-readable size from smallest to largest.
  • The prepared files retain their original sizes.

Hints

Which command chain was practiced earlier?

Use summarized human-readable du output, send it through human-readable sort, and redirect the final output to the report.

Summary

You combined directory measurement, a pipeline, sorting, and redirection to create one useful storage report.

✨ Check Solution and Practice