How to search for files by date?

0110

To search for files by date using the find command, you can use the -mtime, -ctime, or -atime options, depending on whether you want to search by modification time, change time, or access time, respectively.

Examples:

  1. Find files modified in the last 7 days:

    find ~ -mtime -7
    • -mtime -7: Finds files modified in the last 7 days.
  2. Find files modified more than 30 days ago:

    find ~ -mtime +30
    • -mtime +30: Finds files modified more than 30 days ago.
  3. Find files accessed in the last 10 days:

    find ~ -atime -10
    • -atime -10: Finds files accessed in the last 10 days.
  4. Find files changed in the last 5 days:

    find ~ -ctime -5
    • -ctime -5: Finds files whose metadata (like permissions or ownership) was changed in the last 5 days.

Note:

  • The + sign indicates "more than," while the - sign indicates "less than."
  • You can replace ~ with any specific directory path to narrow your search.

If you have any further questions or need more details, feel free to ask!

0 Comments

no data
Be the first to share your comment!