An invariant ensemble of N × N random matrices can be characterised by a joint distribution for eigenvalues . The distribution of linear statistics, i.e. of quantities of the form where f(x) is a given function, appears in many physical problems. In the limit, L scales as , where the scaling exponent η depends on the ensemble and the function f(x). Its distribution can be written in the form , where is the Dyson index. The Coulomb gas technique naturally provides the large deviation function , which can be efficiently obtained thanks to a ‘thermodynamic identity’ introduced earlier. We conjecture the pre-exponential function . We check our conjecture on several well controlled cases within the Laguerre and the Jacobi ensembles. Then we apply our main result to a situation where the large deviation function has no minimum (and L has infinite moments): this arises in the statistical analysis of the Wigner time delay for semi-infinite multichannel disordered wires (Laguerre ensemble). The statistical analysis of the Wigner time delay then crucially depends on the pre-exponential function , which ensures the decay of the distribution for large argument.