How can you tell if you have a viral or bacterial infection?

How can you tell if you have a viral or bacterial infection?