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…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago