Categories: Development

Basic Linux commands Part 2: Storage and disk information

Part 2 in the Basic Linux commands; How to view storage space details and information such as free space on Linux, Part 1 was Navigation, folders and files.

Viewing disk information

Primarily this is done using the Disk file system command df

To view the system disk information in a human readable format (KB, MB, GB and TB) use

df -h

To view as MB use

df -m

View file system types

df -T

Folder sizes

Disk usage (du) can be used for directory sizes

View the current directory size in a readable format summary

du -sh

Or you can specify directory

du -sh directory/foldername

To include 1 level of sub directories in size most to least:

du -h --max-depth=1 | sort -hr

You can change the 1 to 2 or 3 to dive deeper into sub directories.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago