Read free space in Ubuntu via SSH (SSH, 2023, df)

Marc Wag­ner

March 20, 2023

2 min read|

Sto­rage space on your com­pu­ter is a limi­t­ed resour­ce that can some­ti­mes run out, espe­ci­al­ly if you store a lot of files and appli­ca­ti­ons. The­r­e­fo­re, it is important to moni­tor the available space on your sys­tem to make sure you have enough sto­rage for important files and appli­ca­ti­ons. Ubun­tu is a popu­lar ope­ra­ting sys­tem used on many com­pu­ters, and the­re are seve­ral methods to moni­tor the available disk space on your Ubun­tu sys­tem. In this blog post, we will show you how to read free space in Ubun­tu.

Syntax description for use in the shell #

A short syn­tax descrip­ti­on for using the com­mand (df) in the shell (SSH):

df OPTION DATEI

OPTION and FILE are optio­nal para­me­ters

Examples of the “df” console command #

“df” is a com­mand in the Unix and Linux ope­ra­ting sys­tem envi­ron­ment used to dis­play infor­ma­ti­on about sto­rage capa­ci­ty and usa­ge on a file sys­tem. The name “df” stands for “disk free” and indi­ca­tes how much disk space is still available on a par­ti­cu­lar file sys­tem.

Open a con­nec­tion to your ser­ver via SSH with a ter­mi­nal (e.g. put­ty) and enter the fol­lo­wing line:

# Anzeigen des Speicherplatzes
df

# Lesbares Format, -h steht für --human-readable
df -h

# Informationen über eine Partition anzeigen, auf der sich die Datei "placeholder.png" befindet
df -h placeholder.png

After ente­ring the com­mand, you will get a dis­play simi­lar to the fol­lo­wing image:

image
Exam­p­le df ‑h on Ubun­tu with a default block size of 1,000,000

Options / parameters #

Short formLong formDescrip­ti­on
-a–allInclu­si­on of all file sys­tems
-B 10–block-size=10Spe­ci­fi­ca­ti­on of the block size, 100.000 = 100kB
-h–human-rea­­da­­b­leOut­put in a rea­da­ble for­mat
-i–inodesLis­ting of INODE infor­ma­ti­on
-kSet­ting the block size to 1k
-l–localShow local file sys­tems only
-t–type=TYPCon­sider only file sys­tems of type TYPE
-T–print_typeOut­put file sys­tem type
-x–exclude-type=TYPCon­sider all file sys­tems except tho­se of type TYPE
88e86fcb816eff22bc917094df2862d8dd5c0e978b333e6dd5f36f808990c261 96

Arti­kel von:

Marc Wag­ner

Hi Marc here. I’m the foun­der of Forge12 Inter­ac­ti­ve and have been pas­sio­na­te about buil­ding web­sites, online stores, appli­ca­ti­ons and SaaS solu­ti­ons for busi­nesses for over 20 years. Befo­re foun­ding the com­pa­ny, I alre­a­dy work­ed in publicly lis­ted com­pa­nies and acqui­red all kinds of know­ledge. Now I want to pass this know­ledge on to my cus­to­mers.

Hast du eine Fra­ge? Hin­ter­lass bit­te einen Kom­men­tar