A system administrator needs to find all files in /var/log that have been modified in the last 2 hours. Which command should be used?
Trap 1: find /var/log -amin -120
This command is incorrect because `-amin` measures access time (`atime`), not modification time. Access time is updated whenever a file is read, opened, or otherwise accessed, which can happen without any change to the file's content. On modern Linux systems with `relatime` (or `noatime`), accesses may not even update atime reliably, so files modified in the last 120 minutes could be excluded while files merely read are included.
Trap 2: find /var/log -mtime -0.08
The `-mtime` predicate works in 24-hour day increments, not minutes. Although GNU find technically accepts fractional values, `-0.08` is interpreted as a tiny fraction of a day (about 1.9 hours) and is rounded or handled in a way that does not reliably represent a 120-minute window. More importantly, this syntax is non-portable, ambiguous, and not the intended method for fine-grained sub-day searches—`-mmin` exists specifically for this purpose.
Trap 3: find /var/log -cmin -120
The `-cmin` predicate checks inode change time (`ctime`), which is updated whenever file metadata—such as permissions, ownership, link count, or name—changes, not necessarily when the file's content is modified. Even a simple `chmod` or `chown` updates ctime, so this command would return files that were never modified in the last two hours. It is therefore not equivalent to looking for content modification, unlike `-mmin`.
- A
find /var/log -mmin -120
The `-mmin -120` predicate is the correct choice because it directly tests modification time in minutes. A leading minus sign means "less than," so `-120` matches any file whose data was last modified within the last 120 minutes (i.e., less than two hours ago). This precisely answers the requirement to find files in `/var/log` that have been modified in the last two hours.
- B
find /var/log -amin -120
Why wrong: This command is incorrect because `-amin` measures access time (`atime`), not modification time. Access time is updated whenever a file is read, opened, or otherwise accessed, which can happen without any change to the file's content. On modern Linux systems with `relatime` (or `noatime`), accesses may not even update atime reliably, so files modified in the last 120 minutes could be excluded while files merely read are included.
- C
find /var/log -mtime -0.08
Why wrong: The `-mtime` predicate works in 24-hour day increments, not minutes. Although GNU find technically accepts fractional values, `-0.08` is interpreted as a tiny fraction of a day (about 1.9 hours) and is rounded or handled in a way that does not reliably represent a 120-minute window. More importantly, this syntax is non-portable, ambiguous, and not the intended method for fine-grained sub-day searches—`-mmin` exists specifically for this purpose.
- D
find /var/log -cmin -120
Why wrong: The `-cmin` predicate checks inode change time (`ctime`), which is updated whenever file metadata—such as permissions, ownership, link count, or name—changes, not necessarily when the file's content is modified. Even a simple `chmod` or `chown` updates ctime, so this command would return files that were never modified in the last two hours. It is therefore not equivalent to looking for content modification, unlike `-mmin`.