Commands.page Logo

How to Find Files Changed in the Last Hour on Ubuntu

Managing files in Ubuntu often requires tracking recent modifications to troubleshoot issues or organize data. This guide explains the specific command-line tool used to locate files altered within a specific timeframe, focusing on the last sixty minutes. You will learn the exact syntax and options needed to execute this search efficiently without navigating complex menus.

The Find Command

The primary utility for this task is the find command. It searches directory trees for files matching specific criteria. To target files based on modification time, you use the -mmin flag. This flag measures time in minutes rather than days.

Command Syntax

To locate files modified in the last hour, use the following structure:

find [path] -mmin -60

Replace [path] with the directory you wish to search. The -60 argument tells the system to look for files modified less than 60 minutes ago. The minus sign before the number is crucial, as it indicates โ€œless than.โ€

Practical Examples

To search the current directory and all subdirectories, run:

find . -mmin -60

To search your home directory, use the tilde symbol:

find ~ -mmin -60

If you need to search system directories like /etc or /var, you may require superuser privileges. Prepend sudo to the command:

sudo find /var -mmin -60

Filtering Results

You often want to see only files, not directories. Add the -type f flag to restrict results to regular files:

find . -type f -mmin -60

This command ensures that only file entries changed within the last hour appear in your output, making the list easier to read and manage.