Several biochars and activated carbons are prepared from cellulose fraction of some agricultural wastes (linen, cotton and wheat). The obtained carbons are characterized by X-ray diffraction (XRD), transmission electronic microscopy (TEM), 13C nuclear magnetic resonance (13C NMR), CO2 adsorption-desorption at 0 °C, Raman spectroscopy and X-ray photoelectron spectroscopy. The biochars are synthesized at different pyrolysis temperatures while activated carbons are obtained from a biochar (pyrolysis at 500 °C) using KOH as activation agent in different amounts. The adsorption values in the biochars increase proportionally to the temperature levels (about 2.5 mmol CO2 g−1 at 25 °C and 760 mm of Hg). The highest the temperature of pyrolytic treatment, the highest the adsorption values. These values remain stable for several cycles in the case of samples synthesized at the highest temperature. The chemical activation of the biochar with KOH improves its microporosity as well as its CO2 adsorption capacity (3.6 mmol CO2 g−1 at 25 °C and 760 mm of Hg). Moreover, these biochars and activated carbons are evaluated for the adsorption of N2 or H2. The N2 and H2 adsorption capacity is much lower than that of CO2. Consequently, these biochars and activated carbons are highly selective for the CO2 capture. They have also shown a high H2 adsorption at −196 °C which makes them having a high potential in H2 storage at low temperature levels.