Changes

From Amahi Wiki
Jump to: navigation, search
1,305 bytes added ,  13:07, 5 September 2009
New page: <b>Find empty directories:</b> find /path -depth -type d -empty <b>Find empty files:</b> find /path -depth -type f -empty <b>Find a file with a specific name:</b> find /path -name ...
<b>Find empty directories:</b>

find /path -depth -type d -empty

<b>Find empty files:</b>

find /path -depth -type f -empty

<b>Find a file with a specific name:</b>

find /path -name name_of_file

<b>Find a files with specific extensions:</b>

find /path -name "*.given_extension"

<b>Find files with specific permissions which have a ".txt. file extension:</b>

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

<b>Find files with some given permissions:</b>

find /path -perm -permision_bits

<b>Find files with a given name and any extension:</b>

find /path -name 'given_name.*'

<b>Find files modified in the latest blocks of 24 hours:</b>

find /path -mtime n

<b>Where n is:</b>
* 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:</b>

find -atime n

<b>Where n is:</b>
* 0 for the last 24 hours
* 1 for the last 48 hours
* 2 for the last 72 hours

<b>Find files according to owner:</b>

find /path -user root

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

<b>Find and delete files:</b>

find /path -name mytestfile | xargs rm

<b>NOTE:</b> See man find and man xargs for more information about these powerful commands. You can also use the phpMan Amahi one-click app.
12,424

edits