Unix FIND command cheat sheet

Posted on the November 8th, 2009 under Cheat Sheets, Server Admin Tips by Stephen

“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)

 


Share this page:
  • Facebook
  • Twitter
  • StumbleUpon
  • Slashdot
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Live
  • MySpace
  • Technorati
  • LinkedIn
  • Reddit
Related Posts:
  1. Screen cheat sheet
  2. Iptables cheat sheet
  3. RPM cheat sheet
  4. Ubuntu LAMP cheat sheet
  5. How to change server date via ssh shell?

Leave a Comment