---
title: How to Check Disk Usage with df and du Commands
description: "Checking disk usage in Linux is often done using the `df` and `du` commands, which provide details on how much space is being used and where. Here’s how to use each command effectively. ## Checking Disk Usage with `df` The…"
url: "https://truehost.com/support/knowledge-base/how-to-check-disk-usage-with-df-and-du-commands/"
updated: "2024-10-30"
category: Cloud servers in Kenya
---

# How to Check Disk Usage with df and du Commands

Checking disk usage in Linux is often done using the `df` and `du` commands, which provide details on how much space is being used and where. Here’s how to use each command effectively.

## Checking Disk Usage with `df`

The `df` command (Disk Free) is a quick way to view available and used disk space on all mounted filesystems. By default, it shows data in 1K blocks, but you can modify it to display more user-friendly formats.

#### Basic Syntax

```
df [options] [file]
```

**Commonly Used Options**

Below are the most commonly used options with the **df** command

- **Display in Human-Readable Format:**
  - This will show the disk usage in MB, GB, etc., making it easier to interpret.

```
df -h
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-638.png)

- **Check a Specific Filesystem**:
  - Replace `/path/to/directory` with a directory or device to view its usage specifically.

```
df -h /path/to/directory
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-640.png)

- **Include File System Types**:
  - Adds the file system type (e.g., ext4, tmpfs) in the output for each partition.

```
df -T
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-639-1024x172.png)

- **View Inodes Usage**:
  - Displays the number of inodes (used/available) on each filesystem, helpful for diagnosing inode exhaustion.

```
df -i
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-641.png)

## Checking Disk Usage with `du`

The `du` command (Disk Usage) is used to estimate the disk space used by specific files or directories. It’s more detailed than `df`, allowing you to view usage down to the folder level.

### #### Basic Syntax

```
du [options] [directory]
```

**Commonly Used Options**

Below are the most commonly used options with the **du** command.

- **Display in Human-Readable Format:**
  - This will show folder sizes in KB, MB, GB, etc for the working directory.

```
du -h
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-642.png)

- **Summarize Directory Usage**:
  - The `-s` option gives the total size of the specified directory without listing sub-directories.

```
du -sh /path/to/directory
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-643.png)

- **List Directory and Subdirectory Usage:**
  - Shows the disk usage of each directory and sub-directory.

```
du -h /path/to/directory/*
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-644-1024x153.png)

- **Limit Depth:**
  - Limits the depth of directories shown to the specified level, providing an overview of immediate sub-directory sizes.

```
du -h --max-depth=1 /path/to/directory
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-645.png)

### Summary

- **Use `df`** for a broad overview of disk usage across all mounted filesystems.
- **Use `du`** when you want detailed information about specific folders or files within a filesystem.

Together, `df` and `du` offer a comprehensive picture of disk usage on a Linux system, helping with monitoring, troubleshooting, and managing disk space effectively.
