How to Check Disk Space in Linux


To check disk space on Linux, you can use the df command. Here’s how to use it:

  • Open a terminal on your Linux system.
  • Run the following command:bashCopy codedf -h This command will display disk space information in a human-readable format, showing sizes in gigabytes (GB) or megabytes (MB) instead of bytes.

The output will include information about each mounted file system, including the total size, used space, available space, and the mount point.

If you want to check disk space for a specific directory or partition, you can specify the path as an argument to the df command. For example:

df -h /home

This command will show disk space usage specifically for the /home directory.

By default, the df command displays information in 1K blocks. If you prefer to see the sizes in bytes, you can use the -B option followed by the desired block size. For example, to display sizes in megabytes (MB), you can use:

df -BM

There are also other disk usage analysis tools available on Linux, such as du (disk usage), which provides more detailed information about file and directory sizes.