# Files खोजना और Archives (find, tar) — Linux Command Line Fundamentals

Source: https://www.geekswithgeeks.com/hi/linux/linux-find-tar

> find से name, size और age के अनुसार files खोजें, और tar व gzip से archives बनाएँ या extract करें।

## find

`find` directory tree पर चलता है और name, type, size या age से filter करता है।

```bash
find . -name "*.log"            # by name
find /var -type f -size +100M    # large files
find . -mtime -1                 # modified in last day
find . -name "*.tmp" -delete     # act on matches
```

## tar

`tar` files को एक archive में बाँधता है; `-z` gzip compression जोड़ता है। याद रखें: c create, x extract, t list, f file।

```bash
tar -czf backup.tar.gz projects/     # create
tar -tzf backup.tar.gz               # list
tar -xzf backup.tar.gz -C /tmp       # extract
```

पहले `find` को `-print` के साथ चलाएँ और मिलान सही दिखने पर ही `-delete` या `-exec` जोड़ें।

त्वरित जाँच

**Quiz:** backup.tar.gz को कौन-सा command extract करता है?

- [x] tar -xzf backup.tar.gz
- [ ] tar -czf backup.tar.gz
- [ ] tar -tzf backup.tar.gz
- [ ] gzip -c backup.tar.gz

*Answer:* tar -xzf backup.tar.gz. `x` extract करता है, `z` gzip संभालता है और `f` file का नाम देता है।
