Last active
December 20, 2015 06:59
-
-
Save speedlight/6089675 to your computer and use it in GitHub Desktop.
Find usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find all files larger than 2GB (useful for finding pesky logs that prohibit apache from starting) | |
find /usr/local/apache -type f -size +2048000 | |
Find all files owned by the user ”fred” in /home | |
find /home -user fred | |
Find all files with 777 permissions in /home | |
find /home -perm 777 | |
Find only directories with 777 perms | |
find /home/*/public_html/ -type d -perm 777 | |
Find only directories with 777 perms and change to 755 perms | |
find public_html/ -type d -perm 777 -exec chmod 755 ‘{}’ \; | |
Find data owned by user nobody and change ownership to user | |
find . -user nobody -exec chown usernamebob: ‘{}’ \; | |
Find where that pesky config file may be located with a wildcard, when you don’t know the exact name | |
find public_html/ -type f -name “*conf*” | |
Search files for a specific string of text | |
find public_html/ -type f -print0 |xargs -0 grep -si “searchabletext” | |
Use ‘or’ and wildcard to find specific files, and list them, ie. ls any files ending in .php or .html | |
find . \( -name ‘*php’ -or -name ‘*html’ \) -type f -ls | |
Find php files modified within last 60 days: | |
find /home/*/public_html -name ‘*.php’ -type f -mtime -60 | |
Find file modified between 2 and 29 minutes ago. (Did someone change a file within the past half-hour) | |
find public_html/ -type f -mmin +1 -mmin -30 | |
Find hidden files or directories and how much space they are consuming. Looking for anything 1M and over | |
find /home/user/mail/ -maxdepth 1 -type d -name “.*” |xargs du -shc |grep M |less |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment