"How do you do" - Americans really dont say that, but many folks who are not familiar with out culture speak like that. Our english is half slang, so it's difficult to learn. You should first learn the proper way, then try learning slang. With that said, it is the correct greeting to use.
this is how I say hello to a stranger : "Hey man, how's it going" .
But if you use slang, people will laugh at you. You need to speak like it says in the textbook, and not try and come off like you already know the slang. Learn the proper way, then come visit america, and pick up the slang.