When did the US fight a war with tripoli?

First Barbary War - 1801 to 1805