Ravindra BagaleCourses & study guides

Chapter 4: Linux Advanced Commands

4.2 Finding files: find

find /var/www -name "*.html"                 # by name
find / -iname "nginx.conf" 2>/dev/null       # case-insensitive, hide permission errors
find /var/log -type f -size +100M            # files bigger than 100 MB
find /tmp -type f -mtime +7                  # modified more than 7 days ago
find /tmp -type f -mtime +7 -delete          # ...and delete them
find /var/www/html -type d -exec chmod 755 {} \;   # run a command on each result
find . -type f -name "*.log" | xargs ls -lh