9 tar & find (+cron, at)
tar command
tar λͺ λ Ήμ΄λ μ¬λ¬ νμΌκ³Ό λλ ν 리λ₯Ό λ¬Άκ±°λ μμΆνμ¬ νλμ νμΌλ‘ λ§λλ μ μ©ν λꡬμ λλ€. μλμλ tar λͺ λ Ήμ΄λ₯Ό μ¬μ©νμ¬ νμΌμ λ¬Άκ³ , κ·Έλ¦¬κ³ λ¬Άμ νμΌμ ν΄μ νλ λ°©λ²μ λν κ°λ΅ν μ€λͺ μ΄ μμ΅λλ€.
νμΌ λ¬ΆκΈ° (tar)
-c: μλ‘μ΄ μμΉ΄μ΄λΈλ₯Ό μμ±ν©λλ€.
-v: μμΈν μΆλ ₯μ 보μ¬μ€λλ€ (μλ΅ κ°λ₯).
-f: μμΉ΄μ΄λΈ νμΌμ μ΄λ¦μ μ§μ ν©λλ€.
νμΌ μμΆ ν΄μ (tar)
-x: μμΉ΄μ΄λΈλ₯Ό μΆμΆν©λλ€.
-v: μμΈν μΆλ ₯μ 보μ¬μ€λλ€ (μλ΅ κ°λ₯).
-f: μμΉ΄μ΄λΈ νμΌμ μ΄λ¦μ μ§μ ν©λλ€.
λ§μ½ λ€λ₯Έ λλ ν 리μ μΆμΆνλ €λ©΄ ν΄λΉ λλ ν λ¦¬λ‘ μ΄λν ν λͺ λ Ήμ΄λ₯Ό μ€νν©λλ€:
μ΄λ κ² νλ©΄ μμΉ΄μ΄λΈ νμΌμ ν¬ν¨λ νμΌλ€μ΄ /path/to/extract λλ ν 리μ μΆμΆλ©λλ€.
Find command
find λͺ λ Ήμ΄λ 리λ μ€μ μ λμ€ κΈ°λ° μμ€ν μμ νμΌ λ° λλ ν 리λ₯Ό κ²μνλλ° μ¬μ©λλ κ°λ ₯ν λͺ λ Ήμ΄μ λλ€. find λͺ λ Ήμ΄λ λ€μν κΈ°μ€μ μ¬μ©νμ¬ νμΌμ κ²μνκ³ , μνλ λμμ μνν μ μμ΅λλ€.
- [κ²μκ²½λ‘]: νμΌμ κ²μν λλ ν 리λ κ²½λ‘λ₯Ό μ§μ ν©λλ€.
- [μ΅μ ]: κ²μ μ΅μ μ μ§μ ν©λλ€.
- [κ²μ쑰건]: κ²μν νμΌμ΄λ λλ ν 리μ 쑰건μ μ§μ ν©λλ€.
μ£Όμ μ΅μ
-name | νμΌ/λλ ν 리 μ΄λ¦μΌλ‘ κ²μ | find /path/to/search -name "filename.txt" |
-type | νμΌ ννλ‘ κ²μ (f: νμΌ, d: λλ ν 리) | find /path/to/search -type f |
-mtime | μ΅μ’ μμ μκ°μ λ°λΌ κ²μ | find /path/to/search -mtime -7 |
-size | νμΌ ν¬κΈ°μ λ°λΌ κ²μ | find /path/to/search -size +1M |
μμ
cron
cronμ Unix λ° Unix κ³μ΄ μμ€ν μμ μ£ΌκΈ°μ μΌλ‘ μμ μ μ€ννκΈ° μν μ€μΌμ€λ¬μ λλ€. cronμ μ ν΄μ§ μκ°μ μ€ν¬λ¦½νΈ, λͺ λ Ήμ΄ λλ νλ‘κ·Έλ¨μ μ€νν μ μλλ‘ μμ½ν©λλ€. cron μμ μ ν¬κ² μκ°, λ μ§, μμΌ λ±μ κΈ°λ°μΌλ‘ μ€μΌμ€λ§λ©λλ€. μ¬μ©μλ crontab νμΌμ ν΅ν΄ μμ μ cron μμ μ μ€μ νκ³ κ΄λ¦¬ν μ μμ΅λλ€.
- Cron Job: cronμ μν΄ μ£ΌκΈ°μ μΌλ‘ μ€νλλ μμ μ κ°λ¦¬ν΅λλ€.
- Crontab: cron μμ μ μ μνλ νΉλ³ν νμΌμ λλ€.
at
at λͺ λ Ήμ΄λ ν λ²λ§ μ€νν μμ μ μμ½νλ λ° μ¬μ©λ©λλ€. at λͺ λ Ήμ΄λ₯Ό μ¬μ©νλ©΄ ν λ²λ§ μ€νν μ€ν¬λ¦½νΈ λλ λͺ λ Ήμ΄λ₯Ό μ§μ λ μκ°μ μ€νν μ μμ΅λλ€.
- at Job: atμ μν΄ μμ½λ ν λ²λ§ μ€νλλ μμ μ κ°λ¦¬ν΅λλ€.
- cronμ μ£ΌκΈ°μ μΈ μμ μ μ μνκ³ μ£Όλ‘ λ°±κ·ΈλΌμ΄λμμ μ€νλ©λλ€.
- atμ ν λ²λ§ μ€νν μμ μ μμ½νλ©° μμ½λ μκ°μ μ€νλ©λλ€.
λ λͺ λ Ήμ΄λ μκ°μ λ°λΌ μμ μ μ€ννλ λ° μ¬μ©λμ§λ§, cronμ μ£ΌκΈ°μ μΌλ‘, atμ ν λ²λ§ μ€νλλ μμ μ μ ν©ν©λλ€.
tar
tar is a command-line utility in Unix and Linux environments used for bundling files and directories into a single archive file. It is often used in conjunction with compression tools like gzip to create compressed archives. The name "tar" stands for "tape archive," reflecting its historical use in archiving files onto magnetic tapes.
find
find is a command-line utility on Unix and Linux systems designed for searching and locating files and directories based on various criteria. It allows users to specify search conditions such as file name, type, modification time, size, and more. The find command is powerful for locating files in a directory hierarchy and performing actions on them, like executing commands or creating lists.