How to Find Your Linux Disk Space and How to Use It?
Controlling how much data is stored on a Linux server’s hard drive is crucial. For instance, some package managers will warn you if they can’t find enough space on your hard drive to complete an installation. Knowledge of available storage space is necessary for interpreting those results.
Check Linux Disk Space Using Df Command
Simply open a terminal window and enter the following to view your disc usage:
The disc free (df) command provides information on how much space each drive is using. Df displays information in 1,000-byte chunks by default.
Display Usage in Megabytes and Gigabytes
Understanding the Output Format
There may be extra data in your output. There’s no need to provide explanations for each column here.
- Every disc has a unique name, which is referred to as its filesystem. Drives can be either physical (like a hard drive) or logical (like partitions) or virtual (like a temporary drive).
- Its size is the same as the filesystem.
- Used – Total disc space consumption across all file systems.
- Avail – The total quantity of free disc space.
- Displays the percentage of disc space currently in use.
- Where the file system is mounted. This is also known as a mount point in some circles.
Filesystems for both your actual hard drive and any virtual ones you may have are displayed:
Your actual hard drive is located at /dev/sda2. It could be labeled/sda1, /sda0, or you might have multiple. The device is what /dev refers to.
As a substitute for the real /dev directory, udev is used instead. This functionality can be found in the Linux OS.
It’s possible that you have many tmpfs. These are the temporary filesystems that Linux processes like /run use to keep the operating system functioning. For instance, lock files can be made in the tmpfs /run/lock. These files serve to restrict simultaneous edits to the same document.
Read More: Top 5+ Reliable Alternatives to Extra Torrent that Still Function in 2022
Display a Specific File System
Display information about a certain file system with the df command.
The primary hard drive’s utilization is shown here. You can select the drive you want to examine by entering the mount point into the Mounted on the column.
Display File Systems by Type
The command is:
Explicitly enumerating drives of the ext4 type is presented here.
Display File Systems by Type
As an alternative to showing disc utilization in 1024s, you can show it in 1000s.
This can clear up a common misconception about modern data storage methods. Disk storage companies typically advertise their products in terms of storage capacity in terms of kilobytes, where 1 kilobyte equals 1000 bytes.
Operating systems, however, partition the space such that 1024 bytes equals 1 kilobyte. Due to this, the actual amount of usable space on a 1000 GB hard disc is closer to 930 GB.
Display File Systems by Type
Disk use can be viewed with the du command. This program gives you a more granular look at your disc utilization in Linux by displaying it directory by directory. To see how much room your current directory is taking up, utilize this tool.
Display File Systems by Type
It lists the files and folders in the current directory along with their respective sizes. By using the -s option, the output can be streamlined.
You can see here how much disc space is taken up by the current directory.
Check Disk Space in Linux with Du Command
You may have seen a “permission denied” error message when attempting the second command. As a result, the current user does not have permission to enter those folders. Increase your access with the Sudo command:
Read More: Alienware M15 R6 Review: The Quietest, Most Powerful Laptop for Gaming
Conclusion
You should now be able to use the df and du tools to examine Linux disc use. To see all of the available configuration settings, use the df —help or du —help commands.
If you need to perform routine maintenance on your system or are experiencing problems, you can use the fsck command to do so.