Difference between revisions of "Linux-find"

From Amahi Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[Linux-hda commands|Linux HDA Commands]]
+
[[Linux-hda commands|Linux HDA Commands]]<br />
 
[[Basics|Linux Basic Commands]]
 
[[Basics|Linux Basic Commands]]
  
Line 59: Line 59:
 
  find /path -name mytestfile | xargs rm
 
  find /path -name mytestfile | xargs rm
  
<b>NOTE:</b>  See man find and man xargs for more information about these powerful commands.  Recommend you try the phpMan Amahi one-click app.
+
<b>NOTE:</b>  See man find and man xargs for more information about these powerful commands.  Recommend you try the [http://www.amahi.org/apps/phpman phpMan] Amahi one-click app.

Latest revision as of 13:14, 5 September 2009

Linux HDA Commands
Linux Basic Commands


Find empty directories:

find /path -depth -type d -empty

Find empty files:

find /path -depth -type f -empty

Find a file with a specific name:

find /path -name name_of_file

Find a files with specific extensions:

find /path -name "*.given_extension"

Find files with specific permissions which have a ".txt. file extension:

find /path -name '*.txt' -perm 644

Find files with some given permissions:

find /path -perm -permision_bits

Find files with a given name and any extension:

find /path -name 'given_name.*'

Find files modified in the latest blocks of 24 hours:

find /path -mtime n

Where n is:

  • 0 for the last 24 hours
  • 1 for the last 48 hours
  • 2 for the last 72 hours

Find files that were accessed in the latest blocks of 24 hours:

find -atime n

Where n is:

  • 0 for the last 24 hours
  • 1 for the last 48 hours
  • 2 for the last 72 hours

Find files according to owner:

find /path -user root

One can also pipe find commands to the xargs command to execute commands on files.

Find and delete files:

find /path -name mytestfile | xargs rm

NOTE: See man find and man xargs for more information about these powerful commands. Recommend you try the phpMan Amahi one-click app.