Some bacteria are photosynthetic (foe-toe-sin-theh-tick)—they can make their own food from sunlight, just like plants. Also like plants, they give off oxygen. Other bacteria absorb food from the material they live on or in. Some of these bacteria can live off unusual "foods" such as iron or sulfur. The microbes that live in your gut absorb nutrients from the digested food you've eaten.
Many more interesting facts about bacteria can be found throughout the Microbe website, so keep clicking and reading.