Nephi tells the story of killing Laban in 1 Nephi 3:5-18. After he finds Laban, he “was constrained by the Spirit that [he] should kill Laban”. But, Nephi replied, “Never at any time have I shed the blood of man.” And he “would that [Nephi] might not slay [Laban].” Nephi didn’t want to because he had never killed anyone. And,–I don’t know if he knew this–but one of the Ten Commandments is, “Thou shalt not kill” (Exodus 20:13). So how did Nephi give in? First, he remembered that Laban wanted to kill Nephi; that he stole their gold and silver; and that he would never listen to the Gospel. The Spirt told him that it would be better for one person to die rather then a lot of people not believe (hence Jerusalem being destroyed). And the Lord also told Nephi in 1 Nephi 2:20-22: “And inasmuch as ye shall keep my commandments, ye shall prosper, and shall be led to a land of promise; yea, even a land which I have prepared for you; yea, a land which is choice above all other lands…And inasmuch as thou shalt keep my commandments, thou shalt be made a ruler and a teacher over thy brethren.” But how could he keep the commandments if he didn’t have them? And he didn’t! They were on the Brass Plates, which he was trying to get. And that was the reason that Nephi and his brothers came back; that was the reason the Lord helped Nephi get into a position to kill Laban. Nephi also promised, “As the Lord liveth, and as we live, we will not go down unto our father in the wilderness until we have accomplished the thing which the Lord hath commanded us.” And here he was, in a perfect position to get the plates. Now just add the Spirit’s promptings to kill him, and Nephi was persuaded. “Therefore I did obey the voice of the Spirit, and took Laban by the hair of the head, and I smote off his head with his own sword.”
As Nephi was raised in a strong Jewish family, with Lehi a visionary man, I’m sure he knew the law of Moses, including the ten commandments. I think the key is that he needed it written down, as I’m sure Lehi had seen or read, in order to pass it down to his own children. Lehi had learned it and taught it to his own children. But without the record, it would have been very difficult to keep the doctrines pure.