  We study a system of 1D noninteracting spinless fermions in a confining trap
at finite temperature. We first derive a useful and general relation for the
fluctuations of the occupation numbers valid for arbitrary confining trap, as
well as for both canonical and grand canonical ensembles. Using this relation,
we obtain compact expressions, in the case of the harmonic trap, for the
variance of certain observables of the form of sums of a function of the
fermions' positions, $\mathcal{L}=\sum_n h(x_n)$. Such observables are also
called linear statistics of the positions. As anticipated, we demonstrate
explicitly that these fluctuations do depend on the ensemble in the
thermodynamic limit, as opposed to averaged quantities, which are ensemble
independent. We have applied our general formalism to compute the fluctuations
of the number of fermions $\mathcal{N}_+$ on the positive axis at finite
temperature. Our analytical results are compared to numerical simulations. We
discuss the universality of the results with respect to the nature of the
confinement.
