$
학습 Linux 안내서
ko
XP:0
퀘스트 85DeepSearcher
+210 XP

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

이 퀘스트를 위한 인터랙티브 터미널 시작→설치 불필요 • 브라우저에서 바로 실행

개념 및 개요

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 {} +.

명령어 구문 참조

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

검증 목표

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

퀘스트를 완료할 준비가 되셨나요? 85?