How to Find Recently Modified Files Using Terminal on a Mac

Illustration for How to Find Recently Modified Files Using Terminal on a Mac

Quick Answer

Open Terminal and use the find command with a time filter. For example, this command searches your home folder for regular files modified within the last 24 hours:

find "$HOME" -type f -mtime -1 -print

-type f limits the results to files, -mtime -1 selects files modified less than one 24-hour period ago, and -print displays their paths.

For a more precise search measured in minutes, use:

find "$HOME" -type f -mmin -60 -print

That command finds regular files modified within the last 60 minutes. These commands only read file information; they do not change, move, or delete anything.

Terminal showing the command find "$HOME" -type f -mtime -1 -print
Run this command in Terminal for this step.

Before You Start

Terminal searches can scan a large number of files, especially when you search your entire home folder. Begin with a specific folder whenever possible. This makes the results easier to understand and usually completes faster.

You can search:

  • Your home folder with "$HOME"
  • The current folder with .
  • A specific folder, such as "$HOME/Downloads"
  • An external drive by using its mounted path under /Volumes

The examples below use quotes around paths. Quoting is important because it allows Terminal to handle folder names containing spaces.

To open Terminal:

  1. Press Command-Space to open Spotlight.
  2. Type Terminal.
  3. Press Return.

No command in this guide deletes or modifies files. If you later add commands that move or remove results, stop and review them carefully first. File deletion cannot always be undone.

Find Files Modified Within the Last 24 Hours

The simplest useful search is a 24-hour search of your home folder:

find "$HOME" -type f -mtime -1 -print

What the command means:

  • find searches a folder and its contents.
  • "$HOME" represents your macOS user home folder.
  • -type f matches regular files, not folders.
  • -mtime -1 matches files modified less than one 24-hour period ago.
  • -print writes each matching path to Terminal.

The result is a list of file paths, one per line. If nothing matches, Terminal returns to the prompt without listing files.

To search only Downloads, run:

find "$HOME/Downloads" -type f -mtime -1 -print

To search the folder you are currently viewing in Terminal, use a period:

find . -type f -mtime -1 -print

The current folder is the location shown by the pwd command. You can check it before searching:

pwd

pwd displays the current working directory and does not change anything.

Use Minutes for a More Precise Time Range

The -mtime filter works in 24-hour units. Use -mmin when you need a shorter interval.

This command finds files modified within the last hour:

find "$HOME" -type f -mmin -60 -print

For the last 15 minutes:

find "$HOME" -type f -mmin -15 -print

The number after -mmin is measured in minutes. A minus sign means “less than” that amount of time.

For example:

find "$HOME/Documents" -type f -mmin -30 -print

This searches Documents for regular files modified within the last 30 minutes.

Understand the Difference Between -mtime and -mmin

Use -mtime for broad searches:

find "$HOME" -type f -mtime -7 -print

This searches for files modified within the last seven 24-hour periods.

Use -mmin when you need a narrower window:

find "$HOME" -type f -mmin -120 -print

This searches for files modified within the last 120 minutes.

These filters use the file’s modification time, which generally changes when the file’s contents are saved. Opening or viewing a file does not necessarily update its modification time.

Display Modification Dates and Times

A path-only list tells you which files match, but it does not show each file’s timestamp. Add -exec and stat to display the modification date and time:

find "$HOME/Downloads" -type f -mmin -60 -exec stat -f '%Sm %N' -t '%Y-%m-%d %H:%M:%S' {} +

This command still only reads file information. It does not change the files.

Here is what the additional section does:

  • -exec runs another command for every group of matching files.
  • stat reads file metadata.
  • -f '%Sm %N' formats the output as the modification time followed by the file path.
  • -t '%Y-%m-%d %H:%M:%S' sets a sortable year-month-day time format.
  • {} represents files found by find.
  • + lets find pass multiple results to stat efficiently.

The output will contain a timestamp and path for each matching file. The exact files and times depend on what exists in the folder when you run the command.

Terminal showing the command find "$HOME" -type f -mmin -60 -print
Run this command in Terminal for this step.

Search by File Name or Extension

You can combine a time filter with a name filter. The following command finds recently modified PDF files in Downloads:

find "$HOME/Downloads" -type f -iname '*.pdf' -mmin -1440 -print

-iname performs a case-insensitive name match, so it can match .pdf, .PDF, and other capitalization variations. The * wildcard represents any file name before the extension.

To find recently modified image files with common extensions, run separate searches:

find "$HOME/Pictures" -type f ( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.heic' ) -mmin -1440 -print

The escaped parentheses group the name tests. -o means “or.” The command searches Pictures for matching image files modified within the last 24 hours.

Because the command contains several special characters, do not remove the backslashes or quotes. They prevent the shell from interpreting the expression incorrectly.

Limit the Search to the Current Folder

By default, find searches the starting folder and all of its subfolders. To avoid descending into subfolders, use -maxdepth:

find "$HOME/Downloads" -maxdepth 1 -type f -mmin -1440 -print

This checks files directly inside Downloads but does not search folders inside Downloads.

This is useful when you want a quick view of items recently changed at the top level. Remove -maxdepth 1 when you also want results from nested folders.

Search an External Drive

When macOS mounts an external drive, it normally appears inside /Volumes. First list mounted volume names:

ls -la /Volumes

ls -la displays the contents of /Volumes, including mounted drives. It does not modify the drives.

After identifying the volume name, substitute it into a quoted path. For example:

find "/Volumes/Drive Name" -type f -mmin -1440 -print

Replace Drive Name with the exact name shown by ls. Keep the quotation marks if the volume name contains spaces.

Some locations may produce Permission denied messages or may not be accessible to Terminal. macOS privacy controls can restrict access to folders such as Desktop, Documents, Downloads, and data on external volumes. If a search cannot read a location, use a folder you can access or review Terminal’s permissions in System Settings > Privacy & Security.

Do not grant broad access unless you understand why the search needs it. A read-only search does not require permission to modify files.

Avoid Common System and Cache Results

A home-folder search can include application support data, caches, and other folders that are not useful for everyday file management. Search only the folders relevant to your task instead of scanning everything:

find "$HOME/Documents" "$HOME/Downloads" "$HOME/Desktop" -type f -mmin -1440 -print

This searches three common user folders for regular files modified within the last 24 hours.

You can also exclude a folder with -prune. For example, this command skips a folder named Library inside your home folder:

find "$HOME" -path "$HOME/Library" -prune -o -type f -mmin -1440 -print

-prune prevents find from entering the selected folder. The -o means that, if the path is not pruned, the remaining file test is evaluated.

Use exclusions carefully. A file you need may be inside a folder you skipped.

Terminal showing the command find "$HOME" -type f -mtime -1 -print
Run this command in Terminal for this step.

Save Results to a Text File

If the result list is long, save it to a text file in your home folder:

find "$HOME/Downloads" -type f -mmin -1440 -print > "$HOME/recent-downloads.txt"

The > operator redirects the command’s output into recent-downloads.txt. If a file with that name already exists, the command replaces its contents. This is the first example in this guide that changes state by creating or overwriting a file.

To avoid overwriting an existing file, use > with a new name, or use >> to append results:

find "$HOME/Downloads" -type f -mmin -1440 -print >> "$HOME/recent-downloads.txt"

The >> operator adds results to the end of the file.

To remove the report after reviewing it, use Finder, or run this command only if you are certain the file is the report created above:

rm "$HOME/recent-downloads.txt"

Warning: rm permanently removes the specified file without moving it to the Trash. Do not run it if the path is different from the report you intend to remove. The search commands themselves do not require this cleanup step.

Sort Results by Modification Time

The find command does not guarantee that results appear in newest-first order. You can pass the paths to ls and sort them by modification time:

find "$HOME/Downloads" -type f -mmin -1440 -print0 | xargs -0 ls -lt

This uses:

  • -print0 to separate paths safely, including paths containing spaces or unusual characters.
  • xargs -0 to pass those paths to ls without splitting them incorrectly.
  • ls -lt to display details sorted by modification time, newest first.

This command reads file information only. If no files match, xargs may still invoke ls without file arguments, depending on the system’s available options. For a straightforward path list, the unsorted find command is often more predictable.

For a date-and-path format that avoids a separate sort step, use:

find "$HOME/Downloads" -type f -mmin -1440 -exec stat -f '%Sm %N' -t '%Y-%m-%d %H:%M:%S' {} +

Troubleshooting

“Permission denied” appears

Terminal could not read one or more paths. Narrow the search to a folder you can access, such as a specific folder inside your home directory. You can also review System Settings > Privacy & Security for Terminal-related file access.

Avoid hiding errors until you know why they occur. Redirecting errors can make output look cleaner, but it can also conceal folders that were skipped.

No files are listed

Check the following:

  1. Confirm that the starting path exists.
  2. Use a wider time range, such as -mmin -1440 instead of -mmin -60.
  3. Confirm that you are searching for regular files with -type f.
  4. Check whether the file was actually saved. Merely opening a document may not update its modification time.
  5. Run pwd if you used . and want to confirm the current folder.

The command says “No such file or directory”

The path is incorrect or the volume is not mounted. Use Tab completion while typing a path, or list mounted volumes with:

ls -la /Volumes

For folders in your home directory, use "$HOME" rather than typing your user name manually.

Results include unexpected files

The search may include files created or updated by applications, syncing tools, or background processes. Narrow the starting folder, add a file-name filter, or exclude an unnecessary subfolder.

A file’s time does not match when you opened it

Modification time is not the same as access time or creation time. A file may be opened without being saved, so its modification time remains unchanged. If you need to investigate other metadata, use stat on a specific file:

stat "$HOME/Downloads/example.pdf"

Replace the example path with the actual file. This command reads metadata and does not modify the file.

Frequently Asked Questions

Does find delete or change files?

Not in the commands shown here. The searches read directory and file metadata. Be cautious with commands that add rm, mv, or other state-changing actions.

What is the easiest command for recently modified files?

For the last 24 hours in your home folder, use:

find "$HOME" -type f -mtime -1 -print

For a shorter period, replace -mtime with -mmin, such as -mmin -60 for the last hour.

Can I search only Downloads?

Yes:

find "$HOME/Downloads" -type f -mmin -1440 -print

This searches Downloads and its subfolders for regular files modified within the last day.

Why does Terminal show nothing?

No file may match the time range, the path may be wrong, or Terminal may not have access to the folder. Try a broader time range and verify the path.

Can I find recently modified folders?

Yes. Replace -type f with -type d:

find "$HOME" -type d -mmin -1440 -print

This lists directories modified within the last 24 hours. Folder modification time can change when items inside the folder are added, removed, or renamed, so it does not necessarily mean the folder itself was opened.

Final Thoughts

The find command is a reliable way to locate recently modified files without manually checking multiple folders. Start with a specific location, use -mtime for day-based searches or -mmin for minute-based searches, and add stat when you need timestamps. Because these commands only inspect files, you can use them safely for routine storage and file-management investigations.