Does du /
list every single file?
||
Is there a better way?
Does
du /
list every single file?
From man du
:
Summarize disk usage of each
FILE
, recursively for directories.
I do interpret that as: yes, du /
lists every single file under /
. There may be some pitfalls I don't know though.
This will list files if they are given as arguments. Because /
is a directory, du /
lists directories; files are taken into account while calculating sizes of their respective directories; in this case they are not listed.
find
is a standard tool to list files. To list every single file invoke:
sudo find / -type f
where -type f
tells the tool to list regular files only. This way you get your output without the sizes (compared to du
output); it's a good thing if you want only to list the files.
In general case find
is useful because you can specify several criteria to it (the following list is non-exhaustive):
-type
option);I guess you need to have a list of files in order to do something with it. You can use paths provided by find
in a pipe, specify its output (-fprint
option) or execute command for every file found (-exec
). There are also options (like -print0
) designed to avoid problems with some troublesome characters in filenames.
Refer to man find
for more information.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments