Learn More About How To Check Disk Usage In Linux ;

Overview Of Linux
Linux is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution. Linux is the best-known and most-used open source operating system. As an operating system, Linux is software that sits underneath all of the other software on a computer, receiving requests from those programs and relaying these requests to the computer’s hardware.
What Is Meant By Disk Usage In Linux ?
The Linux “du” (Disk Usage) is a standard Unix/Linux command, used to check the information of disk usage of files and directories on a machine. The du command has many parameter options that can be used to get the results in many formats.16 Aug 2021
How To Check Disk Usage In Linux
To spot physical drives or partitions on physical drives look out for listings that begin with /dev/ such as /dev/sda1/. In this case dev stands for device and indicates that the item following it is a physical drive or a partition on a physical drive. Finally, you’ll notice that by default the df command outputs the size of the drive or partition in kilobytes.
Making the df Command Simpler to Read
The raw output generated by the df command can be overwhelming. We can add some simple arguments to the df command to make the output a little easier to read and understand.
1. Use the -h argument to display the sizes and usage in megabytes and gigabytes. The -h argument refers to “human readable”.
df -h
2. Use df -h / to see a broad overview of disk usage. This command will show the disk usage for the main filesystem (/)
df -h /
3. Pass df -h plus the location of a drive to see information on that drive only. On our machine our main physical drive is mounted at /dev/sda2/ which is common but may be different on your system.
df -h /dev/sda2/
On another test system our NVMe drive was located at /dev/nvme0n1p6 Adding a location to df allows us to explore just one area of a file system or one specific drive making the output more focussed and readable.
Specify df Results by File System Type
Using the -t argument in combination with other arguments we can return results only for a specific type of file system. For example FAT, NTFS, ext etc.
1. List results of df command but only for ext4 type filesystems.
df -t ext4
On our example system our main physical drive filesystem is ext4, but you can use any filesystem name you may have on your own system such as, FAT, exFAT, ext3, ext2 etc.
2. Re-run the command adding the -h argument. It’s important that the t argument is placed at the end of the argument list as the t argument expects to be followed by a filesystem type. If for example you want to add the -h argument you must add it before the t as shown below.
df -ht ext4
Exploring Linux Disk Usage with the du Command
Often we might simply want to check how much room a file or directory is using. The du command is useful for this and works in a similar way to the df command we looked at earlier. In the following examples we have used our Music directory which contains 3 subdirectories containing mp3’s. You can use any directory with contents on your system to try these commands.
1. Move to a directory, list its contents and then check disk usage.
cd Music
ls
du
Note that similar to the df command, in its standard form the du command returns values in kilobytes. The output of this command is quite straightforward: it lists the size of each sub directory and then the name and then finally on the last line returns the sum of all the subdirectory sizes to give the directory disk usage.
2. Add the -h argument to make du return results in megabytes and gigabytes.
du -h
3. Simplify the output to just show the total directory size. If we just want to know the total size of the directory and its subdirectories, adding -s as an argument will return just the total.
du -hs
4. Specify a location for the du command.
cd
du -hs Music
Similar to other linux commands we don’t always need to run the du command from within the target directory, rather we can specify a path to a target directory. This can be a relative path, from our current location, or an absolute path.
The df and du commands are deceptively simple but immensely powerful. No matter if you are a relative newcomer or a seasoned sysadmin, both commands are absolutely essential for the smooth running of your Linux machines. At the basic level, each command gives you the information that you need. With the addition of our suggested arguments, these commands are ready to to be part of your sysadmin toolkit.
Source ; https://www.tomshardware.com/
Disclaimer ; Dashboard Logins is to guide you only on how to Login to the portal in question , But not the exact login page. Thank You…