Linux Commands To Check The Disk And Directory Information

Linux Commands To Check The Disk And Directory Information

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
Linux Commands To Check The Disk And Directory Information

Other Interesting Blogs

Leave a Comment

Receive the latest updates

Subscribe and get the latest Foundation Promo codes

Get notified about new promo codes & exclusive discounts

6 Shares
Share via
Copy link
Powered by Social Snap