Linghu Defen was born in 582, during the reign of Emperor Wen of Sui. His ancestors had been from a prominent clan of Dunhuang, but had later relocated to Yi Province . HIs father Linghu Xi served as an official during Emperor Wen's reign but died in anger after being imprisoned due to false accusations of corruption. Late in the reign of Emperor Wen's son , Linghu Defen was made the magistrate of Yaocheng County , but as by that time the Sui realm was had been thrown into a state of confusion due to agrarian rebellions, Linghu never took office. In 617, after the general the Duke of Tang rose in rebellion against Emperor Yang's rule, Li Yuan's cousin Li Shentong rose as well and made Linghu a member of his staff. In late 617, after Li Yuan captured the capital Chang'an and declared Emperor Yang's grandson the Prince of Dai emperor , retaining power as regent, he invited Linghu to serve as a secretary on his staff.
During Emperor Gaozu's reign
In 618, after Li Yuan received news that Emperor Yang had been killed in a coup at Jiangdu , he had Emperor Gong yield the throne to him, establishing Tang Dynasty as its Emperor Gaozu. He made Linghu Defen an imperial attendant. In 622, Emperor Gaozu made Linghu ''Mishu Cheng'' , the secretary general of the archival bureau of government , and had him participate on the compilation of the ''Yiwen Leiju'', with the Chen Shuda.
At that time, after the great disturbance at the end of Sui, much of old book collections had been lost. Linghu advocated, and Emperor Gaozu agreed, to seek out books and purchase them and, once they were bought, to have them copied as well. After several years, the imperial collections were more comprehensive. Linghu also pointed out that while the Southern Dynasties' histories were largely written, little have been formally compiled of Northern Zhou and Sui Dynasty's histories -- and that the deeds of the great people of those two dynasties, including those of Emperor Gaozu's ancestors, would be lost. Emperor Gaozu therefore issued an edict commissioning Xiao Yu, Wang Jingye , and Yin Wenli to compile the history of Northern Wei; Chen, Linghu, and Yu Jian to compile the history of Northern Zhou; Feng Deyi and Yan Shigu to compile the history of Sui; Cui Shanwei , Kong Shao'an , and Xiao Deyan to compile the history of Liang Dynasty; Pei Ju, Zu Xiaosun , and Wei Zheng to compile the history of Southern Qi; and Dou Jin , Ouyang Xun, and Yao Silian to compile the history of Chen Dynasty. However, after the issuance of Emperor Gaozu's edict, not much actual historical compilation was carried out, and the projects stalled.
During Emperor Taizong's reign
In 629, during the reign of Emperor Gaozu's son , Emperor Taizong was interested in the compilation of the histories, and he therefore issued an edict commissioning Linghu Defen and Cen Wenben to compile the history of Northern Zhou ; Li Baiyao to compile the history of Northern Qi ; Yao Silian to compile the histories of Liang and Chen ; and Wei Zheng to compile the history of Sui , and to oversee the overall compilation project with Fang Xuanling. These officials also convened to discuss the issue of the history of Northern Wei, but concluded that as Northern Wei's history has already been compiled in the past by Wei Shou and Wei Dan , it was no longer necessary to have a new compilation. At Linghu's suggestion, the imperial censor Cui Renshi was also invited to join the Northern Zhou project, and Linghu himself also contributed to the compilation of the histories of Liang, Chen, Northern Qi, and Sui. Later historians praised Linghu for spearheading the overall project.
In 632, Linghu was made the deputy minister of rites , but continued to serve as an imperial historian. He was also created the Baron of Pengyang.
In 636, the ''Book of Zhou'' was completed, and Linghu was awarded silk.
In 637, another work by Linghu, the ''New Rites'' , was completed, and his title was promoted to Viscount of Pengyang. Also that year, another project that Linghu participated in, the ''Records of Clans'' , was completed as well, and he was awarded silk again.
In 641, Linghu was made a member of the staff of Emperor Taizong's son Li Chengqian the Crown Prince. In 643, after Li Chengqian was deposed, Linghu was relieved of his duties.
In 644, Linghu was recalled to civil service and made the prefect of Ya Prefecture , but was later removed from office due to his acts there. Soon, however, when Fang was put in charge of compiling the history of Jin Dynasty , Linghu was made the lead editor on the project, which involved 118 editors, and the other editors largely followed Linghu's lead. After the work was completed in 648, Linghu was made ''Mishu Jian'' , the head of the archival bureau.
During Emperor Gaozong's reign
Emperor Taizong died in 639 and was succeeded by his son the Crown Prince . In 640, Emperor Gaozong put Linghu Defen in charge of editing the laws, and made him the deputy minister of rites again, as well as an imperial scholar at Hongwen Pavilion . He was soon made the minister of worship and continued to serve as imperial scholar as well.
In 643, Linghu was made ''Guozi Jijiu'' , the principal of the imperial university. As Linghu had compiled the records of Emperor Taizong's reign after 639, he was awarded silk and made an imperial scholar at Chongxian Pavilion . He was later put in charge of compiling the records of Emperor Gaozong's reign as well, and his title was promoted to Duke of Pengyang. In 662, he requested retirement and was allowed to retire with the honorific title of ''Jinzi Guanglu Daifu'' . He died in 666. It was said that in his late years he was particularly diligent in writing, and whenever there were major compilation projects, he would participate.