We present a systematic short time expansion for the generating function of the one point height probability distribution for the KPZ equation with droplet initial condition, which goes much beyond previous studies. The expansion is checked against a numerical evaluation of the known exact Fredholm determinant expression. We also obtain the next order term for the Brownian initial condition. Although initially devised for short time, a resummation of the series allows to obtain also the long time large deviation function, found to agree with previous works using completely different techniques. Unexpected similarities with stationary large deviations of TASEP with periodic and open boundaries are discussed. Two additional applications are given. (i) Our method is generalized to study the linear statistics of the Airy point process, i.e. of the GUE edge eigenvalues. We obtain the generating function of the cumulants of the empirical measure to a high order. The second cumulant is found to match the result in the bulk obtained from the Gaussian free field by Borodin and Ferrari [1, 2], but we obtain systematic corrections to the Gaussian free field (higher cumulants, expansion towards the edge). This also extends a result of Basor and Widom [3] to a much higher order. We obtain large deviation functions for the Airy point process for a variety of linear statistics test functions. (ii) We obtain results for the counting statistics of trapped fermions at the edge of the Fermi gas in both the high and the low temperature limits. arXiv:1808.07710v1 [cond-mat.stat-mech] 23 Aug 2018 3. Deeper towards the edge: beyond the Gaussian free field 58 B. Large deviations in the linear statistics of the Airy point process (edge of GUE) 59 VI. Application to the counting statistics of trapped fermions at finite temperature 61 A. Edge fermions 61 B. Counting statistics 62 C. High temperature: near the typical rightmost fermion, s ∼ ξ typ , N (s) ∼ O(1) 63 D. High temperature: cumulants of N (s) in the region s ∼ O(1) 64 E. Low temperature: large deviation of the PDF of N (s) in the region s ∼ b 3 66 VII. Conclusions 69 A. First coefficients of the short time expansion for droplet initial condition 71 B. General identities, theorems and proofs of various results 72 1. General identities 72 a. Polylogarithm 72 4 b. Airy function 72 2. Sparre Andersen theorem 73 3. Proof of the identities for the functions L β 73 a. Proof of the identity (50) 73 b. Proof of the identity (51) 74 c. Proof of the identity (52) 74 d. Proof of the identity (53) 75 4. Proof of the identity (101) for propagator of the Brownian initial condition 75 C. Additional identities for the cumulants 76 1. Additional identities (112) and (113) for the first cumulant of the droplet initial condition 76 2. All order expressions 77 D. Analytical continuation 78References 79 the form log P (H, t) −t 2 Φ − (H/t) for large negative fluctuations −H ∼ t when t 1.[36]. In recent works the explicit expression of Φ − (z) for droplet initial condition in the