• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

du Command (Disk Management) in Linux with Examples

{{postValue.id}}

Disk Usage du Command

Introduction:

The Disk Usage du command is the static commands for UNIX/LINUX based distributions. This command is used to check information of disk usage of the files and directories of the system. The du utility first appeared in version 1 of AT& T UNIX

The Disk usage (du)

The du command has many parameter options that can be used to get the results in many formats. The du command also displays the files and directory sizes in different options as per need. Let we discuss du command with various options.

To find disk usage status

The following command will display full disk usage of the /home/linuxManual. The number shown 64, 68, 60 are size of the sub-directories and 1632 refers the total size of that folder.

Example:

[user1@linuxhelp Desktop]$ du 
64        ./linuxfilenotes/df
68        ./linuxfilenotes/rsync
60        ./linuxfilenotes/du
60        ./linuxfilenotes/scp
88        ./linuxfilenotes/linux fhs
344       ./linuxfilenotes
1368      ./LinuxManual
1368

To display in Human Readable Format

This command show the result in “ Human Readable Format” , which means it display the result in KB ,MB ,GB size format Using option ' -h ' with ' du' command.

Example:

[user1@linuxhelp Desktop]$ du -h 
64K     ./linuxfilenotes/df
68K     ./linuxfilenotes/rsync
60K     ./linuxfilenotes/du
60K     ./linuxfilenotes/scp
88K     ./linuxfilenotes/linux fhs
344K    ./linuxfilenotes
1.3M    ./LinuxManual
1.3M

To get grand total of directory

To get grand total of directory use ' -s' in your disk usage where -h is human readable.

Example:

[user1@linuxhelp Desktop]$ du -sh 
1.3M

To find out the disk usage of a directory tree with its sub-tress

Using option ' -m ' with ' du' command finds the disk usage of a directory tree with its sub-tress in Kilobyte , Megabyte , Gigabyte using following options.
To check size in MB size format and also it display KB

Example:

[user1@linuxhelp Desktop]$ du -mh 
104K FTPcpanelaccess/skins/overlay
108K FTPcpanelaccess/skins
63M  FTPcpanelaccess/ftp cpanel access_media

To display grand total of disk usage for individual files

Using option ' -c ' with ' du' command" displays the grand total of disk usage for individual files present in directory

Example:

[user1@linuxhelp Desktop]$ du -ch 
64K                 ./linuxfilenotes/df
67K                 ./linuxfilenotes/rsync
60K                 ./linuxfilenotes/du
.
.
1.3M                ./linuxmanual
1.3M                 total

To Display the disk usage counts for all the files with grand total

The option -a is used to Display the disk usage counts for all the files with grand total.


Example:

[user1@linuxhelp Desktop]$ du -ah
16K   ./linuxfilenotes/df/links_df.odt
44K   ./linuxfilenotes/df/df command.odt
.
.
1.3M ./LinuxManual
1.3M

To calculate and display the disk usage of all files and directories

Using option ' --exclude ' with ' du' command is used to calculate and display the disk usage of all files and directories, but excludes the particular files that match given pattern.

Example:

[user1@linuxhelp Desktop]$ du -ah --exclude=” *.txt” 
16K     ./linuxfilenotes/df/links_df.odt
44K     ./linuxfilenotes/df/df command.odt
.
.
16K     ./LinuxManual/ CHMOD command.odt
1.3M    ./LinuxManual
1.3M    .

To Display the disk usage based on modification of time

Using this option to Display the disk usage based on modification of time.

Example:

[user1@linuxhelp Desktop]$ du -ah --time 
16K   2016-2-15 16:18           ./linuxfilenotes/df/links_df.odt
44M  2016-2-15 16:30            ./linuxfilenotes/df/df command.odt
.
.
16K   2016-2-15 16:18.          ./LinuxManual/ CHMOD command.odt
1.3M 2016-2-15 16:18

To display the disk usage for all files and directories

This option can be used to display the disk usage for all files and directories including hidden files.

Example:

[user1@linuxhelp Desktop]$ du -sh .[!.]* * | sort -n 
16K   ./linuxfilenotes/df/links_df.odt
44K   ./linuxfilenotes/df/df command.odt
.
.
4.0K mydir/.text1.txt                         (hidden files)
4.0K mydir/.text1.txt                         (hidden files)
32K   mydir

Tags:
isaac
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to find disk usage status?

A

The following command will display full disk usage of the /home/:
$ du

Q

How to find disk usage status?

A

The following command will display full disk usage of the /home/:
$ du

Q

How to display the disc usage in Human Readable Format?

A

Execute the following command:
$ du -h

Q

Can I get the grand total of the directory?

A

Run the following command to get the grand total of the directory:
$ du -sh

Q

How to Display the disk usage counts for all the files with grand total?

A

The option -a is used to Display the disk usage counts for all the files with the grand total:
$ du -ah

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.