What is the difference between `find` and `grep` on Linux?
Answer
`find` searches filesystem entries using criteria such as name, path, type, size or modification time. `grep` searches text content for matching lines or patterns. They are often combined: use `find` to select files and `grep` to inspect their content, or use recursive `grep -R` when content search is the main task.
Strong answer includes
- find searches filesystem metadata and paths
- grep searches file or stream content
- knows when to combine them safely
Practical example
To locate JSON logs changed today and inspect them for a correlation ID, first use `find /var/log/app -name '*.json' -mtime 0`, then search the selected files with `grep -n 'abc-123'`.