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.

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