Little is known about the relative contributions and importance of antibacterial effectors in the nematode C. elegans, despite extensive work on the innate immune responses in this organism. We report an investigation of the expression, function and regulation of the six ilys (invertebrate-type lysozyme) genes of C. elegans. These genes exhibited a surprising variety of tissue-specific expression patterns and responses to starvation or bacterial infection. The most strongly expressed, ilys-3, was investigated in detail. ILYS-3 protein was expressed constitutively in the pharynx and coelomocytes, and dynamically in the intestine. Analysis of mutants showed that ILYS-3 was required for pharyngeal grinding (disruption of bacterial cells) during normal growth and consequently it contributes to longevity, as well as being protective against bacterial pathogens. Both starvation and challenge with Gram-positive pathogens resulted in ERK-MAPK-dependent up-regulation of ilys-3 in the intestine. The intestinal induction by pathogens, but not starvation, was found to be dependent on MPK-1 activity in the pharynx rather than in the intestine, demonstrating unexpected communication between these two tissues. The coelomocyte expression appeared to contribute little to normal growth or immunity. Recombinant ILYS-3 protein was found to exhibit appropriate lytic activity against Gram-positive cell wall material.