How did Moses get the ten commandments?

Moses received the Ten Commandments from God after he and the Israelites walked through the wilderness for three months. He climbed to the top of Mount Sinai where God gave his Ten Commandments to Moses (Exodus ch.19-20).