How can I prevent getting infected with pinkeye?

Wash your hands. Pink eye or conjunctivitis is an infection of the covering of the eye or conjunctiva. Most infectious varities are related to direct contact so hand washing and use of clean towels and washcloths will usually prevent these infections. Most viral varieties are associated with the flu or upper respiratory infections nd will resolve with supportive treatment (artificial tears or drops from your doc).