du Command on Linux

29/12/2020
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

Enjoy!

ONET 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, ONET 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

[BigBlueButton] [HDSD-3] Các thao tác của người tham gia phòng họp trên BigBlueButton

Ở bài trước, Onet đã hướng dẫn các bạn các thao tác của người điều hành phòng trên BigBlueButton. Trong...
30/12/2020

Khám phá các gói thuê proxy IPv4 và IPv6 giá rẻ tại Việt Nam, Mỹ, Anh, và Singapore

Nếu bạn đang tìm kiếm một cách đáng tin cậy và tiết kiệm chi phí để truy cập internet mà không...
13/02/2023

Install latest Telegram Desktop Messenger App on Linux

Telegram Desktop Messenger is an open-source and cross platform Telegram client for Linux. Telegram is a messaging app...
28/12/2020
Bài Viết

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

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024