The overwhelming majority of Arabs were unlettered. When the Revelation began, a desire to learn to read and write was aroused and encouraged by the Prophet. Remember that he released literate prisoners captured at Badr only after each of them had taught ten Muslims to read and write. Moreover, the Revelation began with the command: Read, in the name of your Master, Who has created. He created man from a clot suspended (on the wall of the womb). Read, Your Master is the All-Munificent, Who taught (to write) with the pen. He taught man what he had not known (96:1-5).
Despite the importance attached to knowledge and learning, in the early period of his Messengership the Prophet did not allow his Companions to write down what he said. For example, as related in Sahih al-Muslim, he said: "Don't write down what I say. If you have written down something received from me that is not part of the Qur'an, destroy it."  He did not want the Companions to confuse the Qur'anic verses with his own words. The Qur'an was still being revealed and recorded on sheets or fragments of leather or wood; it would assume its final book form at a later date.
This was an understandable precaution, for he wanted to be sure that later generations would not mistake his words for those of God. This is clear from a Tradition narrated by Abu Hurayra: "The Messenger once came near us while some friends were writing down what they had heard him say. He asked what they were writing, and they replied: 'What we heard you say.' The Messenger warned: 'Do you know that the communities preceding you went astray because they wrote down that which is not found in the Book of God?'" 
Another reason for this prohibition is that most of the Qur'anic Revelations came on specific occasions. Thus, some of its verses are concise and clear while others are ambiguous. Allegorical verses appear beside explicit and incontrovertible ones. As a purely Islamic community was still evolving, some commandments came to replace earlier ones. The Messenger also had to address, on various occasions, people with widely varying temperaments and levels of understanding, as well as "new" and "old" Muslims. For example, when a new Muslim asked what the best deed was, he answered that it was belief and performing the five prescribed prayers. However, during a time when jihad had priority, he said it was jihad in the way of God. Further, since Islam is for all time and all people, he frequently resorted to allegories, similes, parables, and metaphors.
These and other factors might have led him to forbid certain individuals to record his words. If everyone had kept a personal account and been unable to distinguish between the real and the metaphorical, the concrete and the abstract, the abrogated and the abrogating, the general and the particular and occasional, the result would have been chaos and misunderstanding. For this reason, 'Umar sometimes warned people not to narrate Prophetic Traditions carelessly.
However, many Traditions state that the Messenger allowed his Companions to write down his words. A time came when the Companions attained the intellectual and spiritual maturity to distinguish between the Qur'an and the Hadith. Therefore, they could give the proper attention and importance to each, and understand the circumstances relevant to each Tradition. And so the Messenger encouraged them to record his Traditions.
Abu Hurayra relates: "'Abd Allah ibn 'Amr ibn al-'As is the only Companion who has as many Traditions as I do. I didn't write them down, but he did." 'Abd Allah reported that he wrote down whatever he heard from the Messenger. Some people told him: "You're writing down everything coming from the Messenger's mouth. He is a human being; sometimes he is angry and other times he is pleased." 'Abd Allah referred the matter to the Messenger, who pointed to his mouth and said: "Write down, for I swear by Him in Whose hand is my life that only truth comes out from this." 
Whether angry or pleased, the Messenger never spoke on his own; out of personal caprice or whim. Whatever he spoke, is a Revelation [explicit or implicit] revealed (53:3-4). As his every word and action had some bearing on Islam, they had to be recorded. The Companions did this holy task either through memorizing or recording what they heard or saw. As a result, his life is the most complete biography ever produced. Every aspect, even its minutest details, has been handed down throughout the generations. This is why we should feel indebted to the Companions and the two or three generations after them, especially the great Traditionists, who recorded and then transmitted his words and actions.
Someone once complained to the Messenger: "O Messenger of God, we hear many things from you. But most of them slip our minds because we cannot memorize them." The Messenger replied: "Ask your right hand for help." In other words, write down what you hear. When Rafi' ibn Khadij asked the Messenger whether they could write down what they heard from him, he was told that they could. As recorded in al-Darimi's Sunan, the Messenger advised: "Record knowledge by writing." During the conquest of Makka, the Messenger gave a sermon. A Yemeni man named Abu Shah, stood up and said: "O Messenger, please write down these [words] for me." The Messenger ordered this to be done. 
'Ali had a sheet, which he attached to his sword, upon which was written narrations about the blood-money to be paid for injuries, the sanctification of Madina, and some other matters. Ibn 'Abbas left behind a camel-load of books, most of which deal with what he had heard from the Messenger and other Companions. The Messenger sent a letter to 'Amr ibn Hazm, which dealt with blood-money for murder and injury, and the law of retaliation. This letter was handed down to Abu Bakr ibn Muhammad, his great-grandson.
Likewise, a scroll transferred from the Messenger to Abu Rafi' was handed down to Abu Bakr ibn 'Abd al-Rahman ibn Harith, one of the Tabi'un.  A leading scholar of that generation, Mujahid ibn Jabr, saw 'Abd Allah ibn 'Amr's compilation Al-Sahifat al-Sadiqa. Ibn al-Athir, a renowned historian, writes that it contained about 1,000 Traditions, half of which were recorded in authentic books of Tradition, with the chain from 'Amr ibn Shu'ayb, from his father, and from his grandfather, respectively.
Jabir ibn 'Abd Allah al-Ansari also left behind a voluminous book containing the sayings he had heard from the Messenger.  Al-Sahifa al-Sahiha is another important source of Hadith from the earliest period. Hammam ibn Munabbih, its compiler, followed Abu Hurayra whenever he went and wrote down the Prophetic sayings reported by him. This compilation, recently published by Muhammad Hamidullah, has been carbon-dated to a period thirteen centuries ago. Almost all of its Traditions can be found either in Musnad ibn Hanbal or the Sahihayn of Bukhari and Muslim.
After these first simple compilations, Caliph 'Umar ibn 'Abd al-'Aziz, who reigned between 99-101 ah, decided that all oral and written authentic Traditions should be compiled systematically into books. He ordered Abu Bakr ibn Muhammad ibn 'Amr ibn Hazm, governor of Madina, to supervise this task. Muhammad ibn Shihab al-Zuhri, renowned for his profound learning and keen intelligence, undertook the task and acquired the honor of being the first official compiler of Traditions. But such an honor was not restricted solely to him: 'Abd al-Malik ibn 'Abd al-'Aziz ibn Jurayj (Makka), Sa'id ibn Abi 'Aruba (Iraq), Awza'i (Damascus), Zayd ibn Qudama and Sufyan al-Thawri (Kufa), Hammad ibn Salama (Basra), and 'Abd Allah ibn al-Mubarak (Khorasan) also were involved.
This period of official and systematic compilation was followed by the period of classification by such great Traditionists as Abu Dawud al-Tayalisi, Musaddad ibn Musarhad, al-Humaydi, and Ahmad ibn Hanbal, who brought out their Musnads. 'Abd al-Razzaq ibn Hammam and others formed their Musannafs, and Ibn Abi Dhi'b and Imam Malik produced their al-Muwattas. Yahya ibn Sa'id al-Qattan and Yahya ibn Sa'id al-Ansari also should be mentioned among the pre-eminent figures of this period.
Then came the period of such great Traditionists as Bukhari, Muslim, Abu Dawud, Nasa'i, Tirmidhi, and Ibn Ma'ja, who produced the well-known, six most authentic books of Tradition. These celebrated persons, and such other illustrious people like Yahya ibn Ma'in, included in their collections what they believed to be the most authentic Traditions after judging them according to the strictest criteria.
For example, Imam Bukhari sought a Tradition from a man renowned for his reliability and piety. When he saw that man hold his hat toward his animal as if it contained something to eat, in an attempt to entice it to come to him, he asked the man if the hat contained some food for the animal. When told that it did not, Bukhari took no Traditions from him. In his view, one who could deceive an animal in this way might also deceive people. Such were the exacting criteria applied when judging the reliability of narrators.
In short, the Prophetic Traditions were either written down or memorized during the time of the Companions. When the first Islamic century ended, they were circulating widely in both oral and written form. Caliph 'Umar ibn 'Abd al-'Aziz tasked eminent scholars with producing the first official compilation in different cities. Authentic Traditions were distinguished from fabricated ones according to the most stringent care and criteria. After they were classified, one of the most systematic and accurate compilations or collections was undertaken by the most prominent Traditionists of that time. Later on, new authentic books of Traditions were produced. Also, such illustrious critics of Tradition as Ibn Hajar al-Asqalani, Ibn Abd al-Barr, Dhahabi, Ibn al-Jawzi, and Zayn al-Din al-Iraqi reviewed all Traditions and wrote large compendiums about their narrators.
As a result of such scholarly activity, the Sunna has reached us through the most reliable channels. No one can doubt the authenticity of this second source of Islam, which approaches the Qur'an in purity, authenticity, and reliability.
 Khatib al-Baghdadi, Taqyid al-'Ilm, 34.
 Abu Dawud, "'Ilm," 3; Ibn Hanbal, 2:162; Darimi, "Muqaddima," 43.
 Darimi, "Muqaddima," 43.
 Abu Dawud, "'Ilm," 3; Tirmidhi, "'Ilm," 12.
 Khatib al-Baghdadi, "al-Kifaya," 330.
 Ibn Sa'd, 7:2; Khatib al-Baghdadi, ibid., 354.