We study an interacting system of N classical particles on a line at thermal equilibrium. The particles are confined by a harmonic trap and repelling each other via pairwise interaction potential that behaves as a power law ∝∑i=jN∣xi−xj∣−k (with k>−2) of their mutual distance. This is a generalization of the well known cases of the one component plasma (k=−1), Dyson's log-gas (k→0+), and the Calogero-Moser model (k=2). Due to the competition between harmonic confinement and pairwise repulsion, the particles spread over a finite region of space for all k>−2. We compute exactly the average density profile for large N for all k>−2 and show that while it is independent of temperature for sufficiently low temperature, it has a rich and nontrivial dependence on k with distinct behavior for −2<k<1, k>1 and k=1.