Difference between revisions of "Du (disk usage) command"

From wikieduonline
Jump to navigation Jump to search
 
(52 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<code>[[wikipedia:Du_(Unix)|du]]</code> (disk usage) Unix and [[Linux]] command used to display file space usage.
+
{{lowercase}}
 +
<code>[[wikipedia:Du_(Unix)|du]]</code> (disk usage) Unix and [[Linux]] command used to display [[file space usage]].
 +
* https://www.man7.org/linux/man-pages/man1/du.1.html
  
  
 +
== Examples ==
 +
* <code>du</code>
 +
* <code>[[du -hs]]</code>
 +
* <code>du -hs *</code>
 +
* <code>du -hs * 2>[[/dev/null]]</code>
 +
* <code>[[du -hs -- *]]  2>[[/dev/null]]</code>
 +
* <code>du -hs -- /path/to/your/dir/*</code>
 +
* <code>du -hs /path/to/file</code>
 +
* <code>du -hs /path/to/directory</code>
 +
* <code>[[du -hs]] [[/var/lib/]]* | sort --human-numeric-sort -rk1</code>
  
== Examples ==
+
* <code>du -h --apparent-size /path/to/file_or_directory</code>
* <code>du -sh *</code>
+
* <code>du -hs --apparent-size</code>
* <code>du -sh /path/to/file</code>
+
 
* <code>du -sh -- *</code>
+
 
 +
 
 +
du -hs [[/var/cache/apt/archives/]]
 +
du -hs [[/var/log/]]
 +
du -hs [[/var/lib/snapd/cache/]]
 +
du -hs [[/var/lib/snapd/snaps/]]
 +
du -hs [[/var/lib/apt/lists/]]
 +
 
 +
[[macOS]]:
 +
[[du -hs /Users/*/brew/]]
  
== Related commands ==
+
== Related terms ==
* <code>[[df]]</code> (disk free)
+
* [[Disk space usage]]
* <code>[[find]]</code>: <code>find . -ls 2>&1 | sort -rnk7 | more</code>
+
* <code>[[No space left on device]]</code>
 +
* <code>[[ncdu]]</code>
 +
* <code>[[df]]</code> (disk free) to show [[file system]] disk space
 +
* <code>[[find . -ls]] 2>&1 | sort -rnk7 | more</code>
 
* <code>[[docker volume ls]]</code>
 
* <code>[[docker volume ls]]</code>
 +
* <code>[[sar -F]]</code>
 +
* [[Node exporter]] ([[Prometheus]]) and [[Zabbix agent]] exposes filesystem statistics, such as disk space used.
 +
* <code>[[sync]]</code>
 +
[[rclone size]]
 +
* <code>[[SELECT pg_database_size('your_db_name');]]</code>
 +
* <code>[[\du]]</code> ([[PostgreSQL]]) for listing users
 +
* <code>[[gsutil du]]</code>
 +
* <code>[[aws s3 ls]] s3://your-bucket --recursive --human-readable --summarize</code>
 +
* <code>[[docker buildx du]]</code>
 +
* <code>[[docker buildx du --verbose]]</code>
 +
 +
==Activities ==
 +
* <code>[[Chgrp, chmod, chown, chcon, du, rm performance information]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{proc}}
 
* {{Linux filesystem commands}}
 
* {{Linux filesystem commands}}
 
* {{du}}
 
* {{du}}
* <code>[[sync]]</code>
+
* {{ls}}
  
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:Linux commands]]
 
[[Category:Linux commands]]

Latest revision as of 08:09, 25 January 2024

du (disk usage) Unix and Linux command used to display file space usage.


Examples[edit]

  • du -h --apparent-size /path/to/file_or_directory
  • du -hs --apparent-size


du -hs /var/cache/apt/archives/
du -hs /var/log/
du -hs /var/lib/snapd/cache/
du -hs /var/lib/snapd/snaps/
du -hs /var/lib/apt/lists/

macOS:

du -hs /Users/*/brew/

Related terms[edit]

rclone size

Activities[edit]

See also[edit]

Advertising: