Linux Check Disk Space


Linux Check Disk Space

It is an essential step to manage disk space over a Linux server. For example, various applications of package managers inform us how much disk space would be needed for the installation process. We should understand how much space our system has available for the data to be meaningful. Apply the df command to check the disk space on Linux and the du command for displaying the disk space usage of the file system.

Understanding the format of the output

  1. Filesystem: The name of all specific drives. This includes logical, physically hard, and temporary or virtual drives.
  2. Size: This is the size of the file system.
  3. Used: This is the space used on all file systems.
  4. Avail: Invalid space amount is not used in all file systems.
  5. Use%: This displays the percentage of disk usage.
  6. Mounted on: This is the directory that placed the file system. In addition, it is sometimes known as a mount point.

The filesystems list contains our virtual hard drives and physical hard drivers:

  • /dev/sda2: This is our physical hard drive. This entry may be listed as / sda1 / sda0, or we may have multiple. This is short for the device.
  • /udev: This is a virtual directory of another directory/dev. This is part of the Linux OS.
  • tmpfs: We may have many of these. Using these types of entries is used as a different temporary file of Linux and other processes to run OS.

For example, the tmpfs / run/lock directory is used to create lock files. Lock files are more limiting files to multiple users from reforming one time.

Checking disk space using the du command

In Linux, we can use the du command to display the disk. This device can show the use of the disk for a directory in Linux for a better viewpoint of our disk usage. We can use it to display the space amount using our current directory.