Tag Archives: size

Ubuntu Terminal: How Much Disk Space do I have Left? CodeUnit 19 AUG 2011

To see how much disk space you have left on your Ubuntu linux desktop or server via the terminal is made easy thanks to the standard df command that comes bundled in most Linux distros.

The most default way to use this is:

df -hT

where the h switch returns the size in user readable units like GBs or MBs, while the T switch prints out the filesystem type.

Nifty.

Ubuntu: Get the Size of a Directory via the Terminal CodeUnit 29 JUL 2011

When using the terminal to navigate your way through your Ubuntu or any other Linux distro, it is actually pretty easy to quickly see how big a particular directory or folder is in terms of size.

The command to use is du, short for Disk Usage. It’s main purpose is to gather and summarize how much of your disk space is being used up by either files or directories in the Linux system.

Basic usage (with the -h switch to report back the size in easy to understand user friendly units) is:

du -h /home/craiglotter

This will recursively list all folders and their respective sizes as well as the total size of the selected folder in the appropriate size unit.

Adding the -s for summarize switch will return only the total file size for the selected directory (this is still recursive in case you were wondering).

du -sh /home/craiglotter

If you want the size for all files in the current directory also displayed, add an asterisk to your query. Similarly, if you want only files of a specific type listed with their respective sizes, modify the asterisk with the desired file extension.

In practice:

du -sh /home/craiglotter *

or

du -sh /home/craiglotter *.txt

Nifty.