Does `du /` list every single file on a system?

voices

Does du / list every single file?
||
Is there a better way?

Kamil Maciorowski

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):

  • should the results include regular files, directories, named pipes,… (-type option);
  • by ctime, atime, mtime;
  • by owner;
  • by permissions;
  • by size.

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to add program to every single file's "open with..." list?

From Dev

Does every single javascript file in a Rails app need .on('page:change', initialize)?

From Dev

Is every single file in the /dev directory is a device file?

From Dev

Does every single service on an OS listen to a port?

From Dev

Python: pair a single element with every element in a list

From Dev

fill every row of a DataFrame with a single list pandas

From Dev

Extend every single string in a list with punctuation

From Dev

List Every Single Registry Key in Windows

From Dev

Assemble every module into a single .js file

From Dev

Measure every single command within a bash file?

From Dev

Does this refer to a file system?

From Dev

Command to wipe every file added to the system

From Dev

Python for loops does not take every element in list

From Dev

Does every file have a MIME type associated with it?

From Dev

Find every occurence of string in a file and store it in a List

From Dev

list of attributes associated with every element of text file

From Dev

How to match every word in the list having single sentence using python

From Dev

Change the encoding of every single .txt file in a folder and its subfolders

From Dev

Rewrite git history replacing a word in every single file

From Dev

Read a text file and store every single character occurrence

From Dev

Change the encoding of every single .txt file in a folder and its subfolders

From Dev

Rewrite git history replacing a word in every single file

From Dev

Is it better to have a single .js file or copy the script in every page?

From Dev

writing every new char element to a single file if it's overwritten

From Dev

Single object binds but list collection does not

From Dev

Custom logs in Azure website file system combined into single log file

From Dev

JSF loading properties file from system dynamicaly every 2 seconds

From Dev

System Calls: Outputing file and pausing every 20 lines

From Dev

Is it safe to revoke group other access to every directory in a file system?

Related Related

  1. 1

    How to add program to every single file's "open with..." list?

  2. 2

    Does every single javascript file in a Rails app need .on('page:change', initialize)?

  3. 3

    Is every single file in the /dev directory is a device file?

  4. 4

    Does every single service on an OS listen to a port?

  5. 5

    Python: pair a single element with every element in a list

  6. 6

    fill every row of a DataFrame with a single list pandas

  7. 7

    Extend every single string in a list with punctuation

  8. 8

    List Every Single Registry Key in Windows

  9. 9

    Assemble every module into a single .js file

  10. 10

    Measure every single command within a bash file?

  11. 11

    Does this refer to a file system?

  12. 12

    Command to wipe every file added to the system

  13. 13

    Python for loops does not take every element in list

  14. 14

    Does every file have a MIME type associated with it?

  15. 15

    Find every occurence of string in a file and store it in a List

  16. 16

    list of attributes associated with every element of text file

  17. 17

    How to match every word in the list having single sentence using python

  18. 18

    Change the encoding of every single .txt file in a folder and its subfolders

  19. 19

    Rewrite git history replacing a word in every single file

  20. 20

    Read a text file and store every single character occurrence

  21. 21

    Change the encoding of every single .txt file in a folder and its subfolders

  22. 22

    Rewrite git history replacing a word in every single file

  23. 23

    Is it better to have a single .js file or copy the script in every page?

  24. 24

    writing every new char element to a single file if it's overwritten

  25. 25

    Single object binds but list collection does not

  26. 26

    Custom logs in Azure website file system combined into single log file

  27. 27

    JSF loading properties file from system dynamicaly every 2 seconds

  28. 28

    System Calls: Outputing file and pausing every 20 lines

  29. 29

    Is it safe to revoke group other access to every directory in a file system?

HotTag

Archive