du Command on Linux

Every Linux distro comes up with a number of tools integrated into the system. Each of the tools has their own purposes. “du” is such a tool that’s part of the standard Unix/Linux. This tool is used for getting info on disk usage and directories on machines. There are a number of available parameters that you can use for getting results in many formats. Here are some of the most useful commands of “du”.

“du” examples

  • Need to find out the disk usage summary of a directory? Run the following command –
  • du ~/Downloads/

In the output, the first column is the disk usage amount and the second column is the list of files present in that directory.

The first column shows the number of disk blocks the corresponding file is occupying.

  • Need the output in a format that human can understand? Use the “-h” option. It tells the “du” to show output in “Human Readable Format”.
  • du -h ~/Downloads

  • Use “-a” flag for displaying the disk usage of all the files and directories.
  • du -a -h ~/Downloads/

As you’ve noticed, you can use multiple flags together with “du”.

  • For identifying just how much disk space is a directory consuming, use “-s” flag.
  • du -sh ~/Downloads

  • You can also use the “-c” flag for getting the total size of the directory at the last line of the output.
  • du -ch ~/Downloads/

  • Need to check out the last time of file modification? You have to use “–time” flag.
  • du -ha –time ~/Downloads/

  • Are you interested in excluding specific file types, for example, MP4 or PDF? Then use the “–exclude=PATTERN” parameter.
  • du -ha –exclude=*.svg ~/Downloads/

More “du” commands

“du” offers a huge collection of features. You can find out all of them using the man page for “du”.

man du

Every time you need help, you don’t have to open up a terminal and run the command again. You can dump the guide into a text file. Run the following command –

man du > ~/Desktop/du.txt


Sandclock IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, Sandclock IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Best Self-Hosted Mapping Software

There’s no denying that Google Maps has made travel much easier: you simply pick your destination and follow a route...

Mounting Partitions Using UUID and LABEL on Linux

If you want to automatically mount a partition to a specific location using /etc/fstab file, then you must put an entry...

XZ Compression Tutorial

Many built-in command-line compression tools are available in Linux operating system. XZ is one of the popular data compression...
Bài Viết

Bài Viết Mới Cập Nhật

Hướng dẫn chuyển đổi windows server windows evaluation to standard và active windows server 2008 + 2012 + 2016 + 2019

How to Update Ubuntu Linux

Squid Proxy Manager cài đặt và quản lý Proxy Squid tự động trên ubuntu

Hướng dẫn cài đặt Apache CloudStack

Hướng dẫn ký file PDF bằng chữ ký số (chữ ký điện tử) và sửa lỗi mới nhất 2021 foxit reader