🎓 A1Learner
🔍
0 of 50 lessons completed

Disk Space

A disk is a device that stores files. A filesystem is the layout that stores files on a disk.

Space on every disk

df -h prints one line for each filesystem. The sizes differ on every machine.

$ df -h

Space for one folder

df -h . prints only the line for the current folder. The sizes differ on every machine.

$ cd ~/practice
$ df -h .

Example

$ cd ~/practice
$ df -h
$ df -h .

Key points

  • Use df to print the space on each filesystem.
  • Use df -h to print the sizes in G and M.
  • The Size column holds the full size of each filesystem.
  • The Avail column holds the space that is still free.
  • The Use% column holds the share that is used.
  • In short, df shows each filesystem, its size, and its free space.

In this example, the first command moves into the practice folder. df -h prints every filesystem next. Each line shows a size, a used share, and the space still free. df -h . prints only the line for the practice folder last. The sizes differ on every machine, so yours will differ.

Note

The sizes differ on every machine.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does df print?