Unix FIND command cheat sheet
“find” is a Unix command allowing us to search for files within our Unix/Linux operating system. “find” can search for files based on name, type, size, modified date, etc… I often use “find” to locate bad files within a hacked system/account.
To search for files by name:
find dir -name keyword
dir: directory you want to search for files
keyword: the name of the file you want to search for
examples:
find /home/test -name “index.txt”
find /home -name “shell*” // find files beginging with “shell”
To search for files by modified date:
by the minute:
find dir -mmin time
by the hour:
find dir -mtime time
examples:
find /home -mmin -30 // find all files modified in the past 30 minutes
find /home -mmin +30 // find all files modified more than 30 minutes ago
find /home -mmin +30 -mmin -60 // find all files modified between 30 and 60 minutes ago
find /home -mtime -1 // find all files modified within the past 1-day (24 hours)
find /home -mtime -7 // find all files modified within the past 1-week (7 days)
Related Posts: