What is the safest way to rename my altcoin from "bitcoin" to "myaltcoin" in the source code?
To find string with in the files (including binary files), issue the command:

grep -rnw '/home/user/' -e 'bitcoin'


It will return every single entry for the word bitcoin in your code.

But I do not think that's the best way to get what you have in mind, what about "if" you have a CONST or a variable in the code called const BITCOIN or bitcoin ?

Your approach would be catastrophic for the base code and probably it will not compile. Just do not do that, instead try to find all the points with the command above, once you find all the entries, change it manually (read the code before you do that) and not using find and replace option from your code editor.