Why can antibiotics be used to treat bacterial infections but not viral infections?
Bacteria are living and can be killed through the use of antibiotics. A virus is not living in the first place.
You would not be given any antibiotic for use to treat a cold or flu. They are both viral infections, not bacterial infections. Antibiotics are only for bacterial infections. If you have a secondary bacterial infection with a viral infection, you might be prescribed an antibiotic to treat that secondary infection, but not for the virus itself.