How to change all occurrences of a word in all files in a directory

A variation that takes into account subdirectories (untested):

find /var/www -type f -exec sed -i 's/privelages/privileges/g' {} \;

This will find all files (not directories, specified by -type f) under /var/www, and perform a sed command to replace “privelages” with “privileges” on each file it finds.

Leave a Comment