Linux: Find recently modified files recursively

List all files in the folder /site/ reverse sorted by modifed date

find /site/ -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r | more

List all php files in the folder /var/www/html/site/ reverse sorted by modifed date

find /site/ -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r | grep php | more

 

Linux Tip: Search & Replace text in multiple files recursively

Here is how to find and replace text across multiple files recursively.

The following command will recursively find all files with extension .html starting with the current folder. In each file, the text apple will be replaced with orange.

find . -name "*.html" -print | xargs sed -i 's/apple/orange/g'