du Linux Commands
What is Linux du Command?
Explanation
du COMMAND:du command is used to report how much disk space a file or directory occupies.
SYNTAX :
du [options] directories
OPTIONS:
-a |
Displays the usage of space that each file is taking up. |
-k |
Write the files size in units of 1024 bytes, rather than the default 512-byte units. |
-s |
Instead of the default output, report only the total sum for each of the specified files. |
-L |
Process symbolic links by using the file or directory which the symbolic link references, rather than the link itself. |
-x |
When evaluating file sizes, evaluate only those files that have the same device as the file specified by the file operand. |
EXAMPLE:
-
du -a images
Output:
12
images/daisy.jpg
20
images/flo.gif
76
images/CHILD.gif
12
images/indigo.gif
152
images/flower.gif
12
images/sunflower.jpg
12
images/tulip-flower-clipart5.gif
12
images/flower.jpg
8
images/thumbnail.aspx
8
images/baby.jpg
12
images/woodpecker.gif
168
images/baby.gif
8
images/thumbnail.jpg
1012
images/house.bmp
12
images/peacock.gif
1544
images
Displays the size of each file in the specified directory.
du -s images
Output:
1544
images
Displays the total disk space used by the specified directory.
du -h
Output:
84K
Displays the current folder capacity.
du -h file1.php
Output:
8.0K file1.php
Displays the storage capacity of file1.php.