In the series of photographs above, tobacco mosaic (a), a bacteriophage (b), influenza B (c) and HIV (d) all attack specific cell types.  Most viruses have a narrow host range, meaning that they can infect only those cells that carry cell markers the viral surface proteins (spikes) have an affinity for.  This is determined genetically by the viral nucleic acids.  Some few such as the rabies virus, however, are generalists, meaning that they can infect a wide range of cell types.