Команда du

Tells you how much space a file occupies.

Синтаксис

du [-a] [-k] [-s] [-d] [-L] [-o] [-r] [-x] directories

-aDisplays the space that each file is taking up.
-kWrite the files sizes in units of 1024 bytes, rather than the default 512-byte units.
-sInstead of the default output, report only the total sum for each of the specified files.
-dDo not cross filesystem boundaries. For example, du -d / reports usage only on the root partition.
-LProcess symbolic links by using the file or directory which the symbolic link references, rather than the link itself.
-oDo not add child directories' usage to a parent's total. Without this option, the usage listed for a particular directory is the space taken by the files in that directory, as well as the files in all directories beneath it. This option does nothing if -s is used.
-rGenerate messages about directories that cannot be read, files that cannot be opened, and so forth, rather than being silent (the default).
-xWhen evaluating file sizes, evaluate only those files that have the same device as the file specified by the file operand.
directoriesSpecifies the directory or directories.

Примеры

du -s *.txt - Would report the size of each txt file in the current directory. Below is an example of the output.

8    file1.txt
8    file2.txt
10  file3.txt
2    file4.txt
8    file5.txt
8    file6.txt

du -ch *.txt - Display the size of the txt files in a friendly size format listing as well as the total capacity of all the files combined. 

Обратно к списку команд