We investigate the potential of exploiting the Sunyaev–Zeldovich effect (SZE) to study the properties of hot gas in galaxy groups. It is shown that, with upcoming SZE surveys, one can stack SZE maps around galaxy groups of similar halo masses selected from large galaxy redshift surveys to study the hot gas in haloes represented by galaxy groups. We use various models for the hot halo gas to study how the expected SZE signals are affected by gas fraction, equation of state, halo concentration and cosmology. Comparing the model predictions with the sensitivities expected from the South Pole Telescope (SPT), Atacama Cosmology Telescope (ACT) and Planck surveys shows that a SPT-like survey can provide stringent constraints on the hot gas properties for haloes with masses M≳ 1013 h−1 M⊙. We also explore the idea of using the cross-correlation between hot gas and galaxies of different luminosity to probe the hot gas in dark matter haloes without identifying galaxy groups to represent dark haloes. Our results show that, with a galaxy survey as large as the Sloan Digital Sky Survey and with the help of the conditional luminosity function model, one can obtain stringent constraints on the hot gas properties in haloes with masses down to 1013 h−1 M⊙. Thus, the upcoming SZE surveys should provide a very promising avenue to probe the hot gas in relatively low-mass haloes where the majority of L* galaxies reside.