First up a note, because there are limits to how hypocritical I'm prepared to look. This is advice on how to give advice _directly_ to other adults. If you're putting general advice up in a public place that people can choose to read or not, then just go ahead and give it. Like I am. Right now.
So you want to give some unsolicited advice to an adult. You've looked at something they were doing, and thought "Hey, they could be doing that better. I should help them!" This is a perfectly reasonable thing to think, and it's lovely that you want to make the world a better place by helping someone to improve themselves*.
However, just leaping in with a "You shouldn't use Windows, it's shit. Use Linux instead, it's awesomesauce!" isn't going to get you very far, even if the person has just been complaining about a virus they got from clicking on an attachment. Instead, you're likely to make them feel patronised, cause hostility, and push them away from the direction you're trying to guide them in.
Instead, I'd like to suggest two routes which work for me when I'm giving people advice.
1: The Direct Route
Give them the advice. But first prime them, by sympathising, and asking for permission.
"Oh, I'm sorry to hear that, having a virus must be a massive pain in the arse. Would you like to hear how you can avoid them in the future?"
The sympathy lets them know that you care about the problem, and by asking them you're letting them decide whether they want the advice _and_ they're more likely to be open to it because they've made an active decision to listen to what you have to say.
2: The Indirect Route
Tell them a story about yourself. Or about a friend. Don't tell them what the advice is, but put the protagonist in their shoes, and then have them follow the path you'd advise them to take.
"Yeah, a friend of mine used to get viruses all the time. Used to really annoy him, until he moved to BSD. Now he can click on anything he likes and not get a virus."
Obviously, this works better if you actually do have a friend who did that. Sticking to the truth is always the better option, and trying to persuade someone based on lies is almost certainly going to backfire _really badly_ at some future point.
Note: In either situation your advice will be much better recieved if you point out any drawbacks yourself. Defanging opposition makes you sound more trustworthy, because you don't sound like a zealot, but instead like someone who understands the positive and negative sides of things.
"Well, you could try Linux. It doesn't have Microsoft Office, or all the latest games, but it has a fair number of games nowadays, and it has Office alternatives that work for most people. Why don't we take a look and see if it could do what you wanted?"
3: Don't Give Advice
Ask yourself why you're giving advice someone hasn't asked for. Are you really doing it for them, or are you just frustrated because you see a problem to fix? There's always the option of not giving them advice, and simply getting on with things yourself, using your better techniques to make your life more awesome than theirs. And if they're interested, they will ask you hiw you made your life so incredibly amazeballs. And _then_ you can tell them.
Or you can just write a blogpost**.
*Assuming that that's why you want to give them advice. If you're just a dick then you don't need this advice either.
**After waiting a couple of weeks from the last time you saw people do The Thing badly, so that people don't think you're talking about them.