Trilobites were filter feeders, meaning that they strained small food particles from the water. They had a pair of antennae on their heads, which they used to sense their surroundings. They also had a pair of mandibles, which they used to crush their food.
Trilobites lived on the ocean floor, where they would burrow into the sediment. They would then extend their antennae and mandibles out of their burrows and wait for food to come by. When they found food, they would use their mandibles to crush it and then swallow it.
Trilobites were able to filter a wide variety of food particles, including algae, plankton, and small animals. They were also able to eat sediment, which they used to extract nutrients from.
Trilobites were an important part of the ancient marine ecosystem. They helped to recycle nutrients and provide food for other animals. They also played a role in the formation of sedimentary rocks, as their shells were often preserved in the fossil record.