$
Aprender Manual de Linux
es
XP:0
Misión 85DeepSearcher
+210 XP

Advanced find by Size, Time & Exec (-size, -mtime, -exec)

Iniciar terminal interactiva para esta misión→Sin instalación requerida • Se ejecuta en el navegador

Concepto y descripción general

Beyond basic filename queries, find is a powerhouse filter engine for automated system cleanup and log rotation:

- -size +50M: Filters for files strictly larger than 50 Megabytes (+ for greater than, - for less than).
- -mtime -7: Filters for files modified within the last 7 days.
- -exec {} +: Passes all matched files directly into a command in batches, replacing {} with matched file paths.

Combining these allows single-line system maintenance, such as finding and purging runaway logs: find /var/log -size +50M -exec rm {} +.

Find large log files modified recently using find /var/log -size +50M -mtime -7, then delete the oversized crash dump using find /var/log -size +50M -exec rm {} +.

Referencia de sintaxis de comandos

Command / SyntaxDescription
find /var/log -size +50M -mtime -7Find files larger than 50MB modified within 7 days
find /var/log -size +50M -exec rm {} +Find and automatically remove files larger than 50MB

Objetivos de verificación

  • ○
    Filter files by size and modification time with find
  • ○
    Delete oversized log using find -exec rm

¿Listo para completar la Misión 85?