The commandery was created during King Wuling of Zhao's reign after a successful campaign against the Linhu (林胡) and Loufan (樓煩) peoples. After the establishment of Qin and Han dynasty, the commandery became the frontier between Han and the Xiongnu. In early Han dynasty, the region saw frequent Xiongnu raids. However, from Emperor Wu's reign onwards, it became an important base of military operations in the wars against the Xiongnu. In 127 BC, it was from Yunzhong that General Wei Qing led a 40,000-men strong cavalry force and conquered the modern Hetao and Ordos regions. In 2 AD, the commandery administered 11 counties, namely Yunzhong (雲中), Xianyang (咸陽), Taolin (陶林), Zhenling (楨陵), Duhe (犢和), Shaling (沙陵), Yuanyang (原陽), Shanan (沙南), Beiyu (北輿), Wuquan (武泉) and Yangshou (陽壽). The population totaled 38,303 households, or 173,270 people. During Eastern Han, 3 counties were abolished, while 3 new counties were added from Dingxiang Commandery. In 140 AD, the population was 5,351 households, or a population of 26,430. Toward the late Han dynasty, the area's population decreased sharply as residents fled from invading northern nomadic peoples, and the commandery was dissolved.