Difference between revisions of "Du"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
m (Reverted edits by 221.178.182.29 (talk) to last revision by ThorstenStaerk)
 
(3 intermediate revisions by 2 users not shown)
Line 14: Line 14:
 
  1.2M    CMakeFiles/
 
  1.2M    CMakeFiles/
 
  1.2M    total
 
  1.2M    total
 +
 +
= be aware =
 +
<pre>
 +
tweedleburg:~ # du -sch archiv
 +
0      archiv
 +
0      total
 +
tweedleburg:~ # du -sch archiv/
 +
80G    archiv/
 +
80G    total
 +
tweedleburg:~ # ll archiv
 +
lrwxrwxrwx 1 root root 22 Jul 15 13:09 archiv -> /mnt/barracuda/archiv/
 +
</pre>
  
 
= See also =
 
= See also =
Line 19: Line 31:
 
* [[ls]] - list files
 
* [[ls]] - list files
 
* [[commands]] - other commands
 
* [[commands]] - other commands
* [http://man-wiki.net/index.php/Du The du man page]
+
* [http://unixhelp.ed.ac.uk/CGI/man-cgi?du The du man page]

Latest revision as of 18:00, 7 January 2016

The command du allows you to find out the disk space used by a file:

# du -csh *
1.2M    CMakeFiles
4.0K    CMakeLists.txt
8.0K    CMakeTmp
4.0K    browser.cpp
4.0K    browser.h
4.0K    main.cpp
1.3M    total

The difference to ls -l is that you can get a total and that directories are also shown with the correct size.

# ls -ld CMakeFiles/
drwxr-xr-x 7 root root 4096 Feb 14 10:12 CMakeFiles/
# du -csh CMakeFiles/
1.2M    CMakeFiles/
1.2M    total

be aware

tweedleburg:~ # du -sch archiv
0       archiv
0       total
tweedleburg:~ # du -sch archiv/
80G     archiv/
80G     total
tweedleburg:~ # ll archiv
lrwxrwxrwx 1 root root 22 Jul 15 13:09 archiv -> /mnt/barracuda/archiv/

See also