Linux File Space Estimating

LinuxLinuxBeginner
Practice Now

Introduction

In the ancient Greek Olympic arena, revered amongst those of athletics and wisdom, there was a concept not known to many – the art of space estimation. This art was not about the physical distances in the broad sunlit arenas, but about the spaces within the sacred scrolls that contained the wisdom of countless generations. Amongst the Olympic priests, there was a learned figure, known for his wisdom in managing these valuable scrolls. As days turned to nights, scrolls turned to tomes, and the need to efficiently manage space became paramount. Hence, the Olympic priest embarked on a mission to teach his apprentices the way of Linux file space estimation using the du command – a skill as critical as any when in the pursuit of order and knowledge management.

Your goal in this lab is to step into the sandals of an apprentice and master the techniques taught by the Olympic priest, estimating file space with precision and insight on a Linux system. Your journey will be exciting and will open doors to the knowledge akin to the old wise scholars of the Olympic arena.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/SystemInformationandMonitoringGroup(["`System Information and Monitoring`"]) linux/SystemInformationandMonitoringGroup -.-> linux/du("`File Space Estimating`") subgraph Lab Skills linux/du -.-> lab-271271{{"`Linux File Space Estimating`"}} end

Understanding the du command

In this step, you will learn the basic usage of the du (Disk Usage) command, which is essential for estimating file space on a Linux system.

Start by creating a directory structure to work with. You will be creating a scrolls directory where all your practice files will reside.

Execute these commands in your terminal:

mkdir -p ~/project/scrolls
cd ~/project/scrolls
touch scroll1.txt scroll2.txt scroll3.txt
echo "Wisdom of the Olympic games" > scroll1.txt
echo "Tales of Herculean feats" > scroll2.txt
echo "Chronicles of the gods" > scroll3.txt

Now, estimate the space used by the scrolls directory using the du command.

du -sh ~/project/scrolls

The -s option summarizes the total space and the -h option makes the output human-readable.

Estimating individual file sizes

In this step, you will use the du command to estimate the size of individual files within the scrolls directory.

du -h ~/project/scrolls/scroll*.txt

This command will display the estimated size of each scroll file in a human-readable format.

Summary

In this lab, we journeyed through the basics of Linux file space estimation using the du command, a tool as essential as any in the arsenal of a system administrator. We touched on the philosophy of the ancient Olympic Games, weaving historical fantasy with practical skills. The design thoughts centered not just on imparting knowledge but on doing it in an engaging and stimulating way, providing a narrative to help new users remember and enjoy the learning process. You are no longer just apprentices of file management; you are scholars of space estimation, with skills that would make any Olympic priest proud.

Other Linux Tutorials you may like