Linux Commands To Check The Disk And Directory Information
- Last Updated On: June 21, 2021
- By: Scriptcrunch Editorial
Even though you can check the disk, directory information, and usage using the graphical user interface, it is important to know the terminal commands to check the disk information and usage of a Linux machine.
In this tutorial, you will learn the important commands to check the disk and directory information in Linux systems.
There are two basic commands for the disk and directory. du and df. du deals with directories and df deals with the disk.
Check Linux Disk Usage With du Command
du
command is used to determine the size of a directory.
Let’s say you have a directory demo and you have five directories named 1,2,3,4 and 5 inside the demo. If your current directory is a demo and if you use du it will show the size of the folder inside it.
du
Lets look at different flags supported by du
command.
#1: Displaying memory of directory in human readable form
du -h
#2: Let’s say you want to find out the total size of /Downloads
folder, use the command below and the last two lines will show the total size of the /Downloads
folder.
du -c -h /Downloads
If you just want to see the size use the tail command as follows to see the last two lines.
du -c -h /Downloads | tail -2
Check Linux Disk Space using df Command
Lets look at different examples of using df
command to check the disk space in Linux
#1: df command gives the information about the disk space, mount point, used space, unused space, and used space in percentage.
df
#2: Getting the innode info.
df -i
#3: Getting disk info in human-readable form (Both Kb and Mb)#
df -h
df -k
#4: Getting all the info about file system and its type
df -a
df -T
#5: Getting information about a specific file system type like ext3 or ext4
df - t ext3
#6: Getting information about the total memory of the disk.
df -h --total
Scriptcrunch Editorial
Other Interesting Blogs
[50% OFF] Kubernetes Certification Coupons (CKA, CKAD, CKS, KCNA and KCSA)
Looking for CKA coupon and other Kubernetes certification coupon codes? You have come to the right place. Following are the list of
[80% OFF] Linux Foundation Coupon for December 2024
Looking for CKA Coupon and other Linux Foundation certifications coupons? We got you covered. With the latest Linux Foundation Coupon, you can
[65% OFF] Linux Foundation LFCA, LFCS & LFCT Exam Voucher Codes
Linux Foundation has announced up to a $284 discount on its Linux certification programs Linux Foundation Certified IT Associate (LFCA) and Linux
1 thought on “Linux Commands To Check The Disk And Directory Information”
I just went to your site. i have a question is this a good way to contact you?