Understanding 'DU' Command in Linux

04 May 2023 Balmiki Mandal 0 Linux

What is DU Command in Linux?

The DU Command (Disk Usage) is a Linux command used to view the amount of disk space a file or directory is taking up. By providing a summary of disk space used, it helps users manage their storage resources by showing them which directories are taking up the most space, so they can easily identify areas for cleaning or optimization.

How to Use DU Command in Linux?

The DU command is used in the following format:

du [options] [directories/files]

Where the options are optional and the directories/files are the names of the directories or files that you want to examine. Here's an example of a DU command:

du -a /var/www

This command will list all the files and directories in the /var/www folder and display their size in bytes. This information can be useful when trying to spot large files or directories that are taking up unnecessary space.

What are Some Commonly Used Options with DU Command?

  • -a - Displays all files and directories.
  • -h - Displays sizes in human-readable format (in kilobytes, megabytes, etc).
  • -s - Displays only the total size of the directory or file.
  • -S - Displays the total size of each directory.
  • -c - Displays the grand sum of all sizes.
  • -x - Skips directories on other filesystems.

Conclusion

The DU command is a powerful tool for managing disk space on Linux systems. It can help users identify which files and directories are taking up the most space. By supplying options, users can further customize the command to better suit their needs.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.