Replace multiple instances of a file with find

I needed to replace a file that existed in multiple locations on my system with a new copy.

At first I considered a for loop in bash to do it, but then it occurred to me that find would be an ideal fit for this.

To search and replace a file(s) with find, go to the directory you want to search under and use the following command:

find . -name FILENAME -exec cp -f /PATH_AND_NAME_OF_NEWFILE {} \;

That’s it.

This handy little command will search out all instances of FILENAME under your current location and replace them with the new file.

Oh and if  you are using Windows, you can do the same thing with the find included with cygwin.

You ARE running cygwin, aren’t you? If not, then give it a shot. 🙂


Source and Destination Network Address Translation (SNAT / DNAT) with iptables

A colleague of mine approached me with a need to do some IP address translation.

He had a machine (A) with an IP of and he wanted any connections coming to this machine to get rerouted to another machine (B) with an IP address of

Machine A was a linux system and was the default gateway for machine B (*). This was a perfect fit for a  SNAT/DNAT using iptables.

Read more of this post