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
[80% OFF] Linux Foundation Coupon for November 2024
Hi Techies, I wanted to let you know about a pretty sweet deal with the Linux Foundation Coupon that is running now.
[40% 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
CKA Certification Study Guide (Certified Kubernetes Administrator)
This comprehensive CKA certification exam study guide covers all the important aspects of the Certified Kubernetes Administrator exam and useful resources. Passing
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?