Through X-rays we can gain insights on the structural parameters of dark matter halos in dynamically relaxed clusters of galaxies and on the large-scale distribution of the diffuse "missing baryons" in the local universe. In this talk I will show how X-rays can be fruitfully used to: 1) explore the inner dark matter profile in clusters of galaxies accounting also for possible modifications induced by the presence of baryons; 2) investigate the predicted correlation of the halo concentration parameter with mass for X-ray emitting galaxy systems and its dependence with redshift in the case of clusters of galaxies. I will then review the sparse evidences collected so far by X-ray studies of the existence of the so called Warm-Hot Intergalactic Medium, a theoretically predicted gas phase distributed in the large-scale filamentary structure of the local universe, which is considered to be the reservoir of the local "missing baryons".