When Colbert asked him to actually name the commandments, I think he was only able to come up with 2 (maybe 3).
This was a turning point in the West Wing pilot! A bunch of religious televangelist/activist types being frumpy and pissy with Josh and Toby, complaining about the lack of 10 commandments in public places etc. etc., and one of the televangelists is using the 3rd commandment as the 1st, adn Toby keeps quietly correcting him, and suddenly President Sheen sweeps into the room, reciting the actual 1st in his stentorian glory.
It was kind of a foolish scene, because I don't know anybody with any religious education who can't recite the beginning at least of most of the famous phrases; and really, there are a lot of variations for how the commandments are phrased, so you can fudge it a lot as long as you get the concept right, and really really, what do you think comes first when defining the tenets of a religious system?
(I did think it was funny that Bartlet recites the Catholic variant of the 1st commandment, long before he is canonically described as Catholic; both because that's the version I know and because of all the version to annoy a group of fundamentalists, the Catholic version is probably it.)