linux_wiki:find

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
linux_wiki:find [2015/03/24 23:32]
billdozor created
linux_wiki:find [2016/03/18 23:21]
billdozor [Find]
Line 6: Line 6:
  
 **Checklist** **Checklist**
-  * Distro(s): All+  * Distro(s): Any
  
 ---- ----
Line 37: Line 37:
  
 <code bash> <code bash>
-nice find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n+nice find / -mount -printf '%h\n' | sort | uniq -c | sort -n -k 1
 </code> </code>
  
Line 43: Line 43:
   * nice = Use nice in a production environment to lower CPU scheduling priority by a default of 10, as find can be CPU intensive   * nice = Use nice in a production environment to lower CPU scheduling priority by a default of 10, as find can be CPU intensive
   * find / = start in the "/" directory (change this to the root of a mount point you wish to investigate as identified by 'df -i')   * find / = start in the "/" directory (change this to the root of a mount point you wish to investigate as identified by 'df -i')
-  * xdev = Do not descend directories on other file systems. +  * mount = Do not descend directories on other file systems. 
-  * printf '%h\n' = Print the leading directories of a file's name, then a newline+  * printf '%h\n' = Print the leading directories of a file's name (%h), then a newline (\n). (man find, then search for 'printf\ format' to see all available formats)
   * sort = Default sort by starting of line alphabetical   * sort = Default sort by starting of line alphabetical
   * uniq -c = Filter matching adjacent lines, prefix lines with the count of occurrences   * uniq -c = Filter matching adjacent lines, prefix lines with the count of occurrences
-  * sort -k 1 -n = Sort via the "key" starting at 1 (field 1the numbernumerically+  * sort -n -k 1 = Sort numerically (-n) via the "key" (-k) at field 1 (field 1 is the count from 'uniq -c').
  
 This will give output with the first column displaying file count and the second column displaying the folder it is in. This will give output with the first column displaying file count and the second column displaying the folder it is in.
  • linux_wiki/find.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)