Exposing Caenorhabditis elegans to non-coding small RNAs from pathogenic Pseudomonas aeruginosa induces avoidance behaviours in treated worms and their progeny, which reveals how C. elegans discriminates between bacterial species in its microbial environment.