...

How to check disk space in Linux

20, Feb 2023 | Linux

Checking disc space is an important task for system administrators or users in Linux. It allows them to monitor their storage utilization and avoid data loss due to a full disc. This article will go over various methods for checking disc space in Linux.

How to check disk space on linux

1. Using the df command:

The df (disk-free) command is a standard Linux command that displays the file system’s disc space usage.

Open a terminal and type the following command to use the df command:

df -h

The -h option shows how much space is being used on the disc in units that people can understand, like kilobytes (K), megabytes (M), or gigabytes (G). The df command returns the total disc space, used disc space, available disc space, and the mount point of the file system.

2. Using the du command:

Another common Linux command is du (disc usage), which displays the disc space usage of a specific directory or file.

Open a terminal and type the following command to use the du command:

du -sh /path/to/directory


The -s option displays disc usage in summary form, while the -h option displays disc usage in human-readable form. Replace “/path/to/directory” with the full path to the directory to be checked.

3. Using the GUI:

Most Linux distributions include a GUI-based file manager that displays disc space usage information.

To use the GUI, launch the file manager and navigate to the desired directory. Right-click on the directory and select “Properties.”. The properties window will show you the disc space usage of that directory.

4. Using the ncdu command:

The ncdu (NCurses Disk Usage) command is a lightweight and fast disk usage analyzer that provides an interactive interface to view disk usage.

You must first install the ncdu package before you can use it. It is available on most mainstream distributions and can be found through the operating systems distributions package manager.


Type the following command in a terminal to install ncdu on Ubuntu or Raspbian:

sudo apt-get install ncdu


Open a terminal after installation and enter the following command:

ncdu /path/to/directory


The ncdu interface displays the directory’s disc usage in an interactive format, and you can navigate through the directories and subdirectories to get more information. Replace “/path/to/directory” with the full path to the directory to be checked.

To summarize, checking disc space usage is an important task in Linux, and there are several methods for doing so.

The df and du commands are standard and provide important disc usage information.

For users who prefer a graphical interface, the GUI file manager is an excellent choice.

The ncdu command is a lightweight and fast disc usage analyzer that provides advanced users with an interactive interface.

0 Comments

<a href="https://www.addictedtotech.net/author/attadmin/" target="_self">Addicted2Tech</a>

Addicted2Tech

We love technology and enjoy sharing helpful FREE content for others to enjoy. We believe in community. If you like what we do please support us by sharing and liking our tutorials & Subscribing to our YouTube channel. You can also follow us on social media.

Support Our Work!

Donate Via Patreon




Raspberry Pi 4 Model B 8GB

Last update on 2024-06-18 / Affiliate links / Images from Amazon Product Advertising API

CanaKit Raspberry Pi 4 Extreme Kit – 128GB Edition (4GB RAM)

Last update on 2024-06-18 / Affiliate links / Images from Amazon Product Advertising API




We Are An Affiliate!

Just so you know, we may collect a share of sales or other compensation from the links on this page. As an Amazon Associate, I earn from qualifying purchases.

The affiliate link recommendations come at no extra cost to you.

We hope you love the products we recommend!

Thank you if you use our links; we really appreciate it!




Related Posts

Essential Tips to Learn Linux and Become an Expert

Essential Tips to Learn Linux and Become an Expert

If you've always had the desire to learn Linux, then you've stumbled upon the best resource to aid you in your mission. Here, we've put together a guide of essential tips to kickstart your journey. The knowledge of Linux can be highly beneficial as it can enhance your...

read more
is Linux dead – 5 Reasons Linux is still relevant

is Linux dead – 5 Reasons Linux is still relevant

Today we want to ask the question is Linux dead? or is Linux dying out?. In this post, we break down the data. It started as a hobby for Linus Torvalds all the way back in 1991 when Linux was first released. Over the following years, the Linux kernel grew in...

read more
Is Linux Difficult To Learn

Is Linux Difficult To Learn

It is an important question to ask for every newbie to Linux. Is Linux difficult to learn?. Today we are going to look into this question in more detail. You will be surprised to know it is not as simple to answer as you may think. What is Linux in a nutshell?. Linux...

read more