Find Commands

 

Hi,

This document will help you in using “find” command in linux server.

 

Find command to find a file name in the server is

 find /path/to/directory/which/you/need/to/search -name filename

Find command to list the files with 777 permissions is

 find /path/to/directory/which/you/need/to/search -type f -perm 777

change the 777 to the desired permission which you need eg: 644.

Find command to list the directories with 777 permission is

find /path/to/directory/which/you/need/to/search -type d -perm 777

change the 777 to the desired permission which you need eg: 755.

Find command to change the files with permission 777 to 644 is

find /path/to/directory/which/you/need/to/search -type f  -perm 777 -print -exec chmod 644 {} \;

Similarly the find command to change directories with permission 777 to 755 is

you can change the 644 to the desired permission you need to set to that particular file

find /path/to/directory/which/you/need/to/search -type d  -perm 777 -print -exec chmod 755 {} \;

you can change the 755 to the desired permission you need to set to that particular directory

 

To find all files modified on the 7th of June, 2007

 find . -type f -newermt 2007-06-07 ! -newermt 2007-06-08 

 

 

Thank you for viewing helpinlinux.com

Leave a Reply

Protected by WP Anti Spam