Replace text in multiple files
Use sed with find to do a batch search-and-replace across many files at once.
$ # Replace 'foo' with 'bar' in all .conf files:
find /etc -name '*.conf' -exec sed -i 's/foo/bar/g' {} +
# Preview changes first (dry-run):
grep -rl 'foo' /etc/*.conf
sedmaster2026-04-19
Delete this trick? This cannot be undone.