30.1 C
Texas

Linux Commands for Checking How Much Space is Left on Deck

Examining your Linux system’s disk space is important to control and ensure the smooth operation of the system. Moreover, you can investigate and manage the remaining storage space on your disk by using commands such as df, du, ls, and ncdu. Overall, these tools will help you maintain an efficient and well-organized system.

In this article, we will explore the top four commands for checking the disk space on Linux.

How to Check Left Disk Space on Linux?

To check the free space on your disk, you can use the below-listed commands:

  • df
  • du
  • ls
  • ncdu

Now, let’s check out the usage of the above-listed commands.

Method 1: Checking Disk Space with df Command

- Advertisement -

The df command in Linux shows you information about how much space is used in all the connected storage areas.

To make the information easier to understand, you can use the -h option with the df command in Linux:

$ df -h

This option shows the sizes in units like megabytes, and gigabytes, and makes the output more human-readable.

Method 2: Checking Disk Space with ls Command

You can use the Linux ls command with the -lh options for listing files in a directory along with their sizes in a human-readable format:

 $ ls -lh /home/linux

Method 3: Checking Disk Space with du Command

When you want to see how much space a specific directory is taking up, use the du command in Linux. It helps you check the storage usage in a particular folder.

For clear results, add -h to the du command in Linux for human-readable sizes. Also, you can use –max-depth to limit the search to the desired levels:

$ du -h –max-depth=2 /home/linux

As a result, the output shows only the sizes of the subdirectories.

Method 4: Checking Disk Space with ncdu Command

To view detailed disk space information and navigate directories in Linux, you can use the ncdu command. However, before using it, you need to install it first:

$ sudo apt-get install ncdu

Now, we will execute the ncdu / command:

$ sudo ncdu /

This command opens ncdu with special permissions, allowing it to scan and show detailed info about how the disk space is used in the root directory.

Additionally, you can include a specific directory to see detailed information, such as total disk usage, apparent size, and the number of items it contains:

$ ncdu /home/karim

Conclusion

In this write-up, we have covered content related to Linux commands like df, du, ls, and ncdu for checking and managing disk space. Applying these methods helps you understand and organize your system’s storage effectively.

More information:

https://greenwebpage.com/community/

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article