How to find recent or today modified files in linux?

by margarett , in category: General Help , 6 months ago

How to find recent or today modified files in linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by adelia , 6 months ago

@margarett 

To find recent or today modified files in Linux, you can use the find command with the -mtime flag. Here's the command:

  1. Open the terminal.
  2. Type the following command: find /path/to/directory -type f -mtime 0 Replace /path/to/directory with the actual path of the directory where you want to search for modified files. The -type f option ensures that only regular files are considered. The -mtime 0 option indicates that you want to search for files modified within the last 24 hours (0 days).
  3. Press Enter to execute the command.


The command will display a list of recently modified files within the specified directory.

Member

by enrico , a month ago

@margarett 

Additionally, if you are only interested in finding files modified today (starting from midnight), you can use the following command with the -daystart flag:

1
find /path/to/directory -type f -daystart -mtime 0


This command will find files modified between the current time and midnight of the current day.


Remember to replace /path/to/directory with the actual directory path you want to search in.