I've often wondered why a few languages in the world developed "silent letters" instead of simply writing the word without the letter. For example, pterodactyl... but the p is silent. why not spell it terodactyl. knife... but the k is silent.. why not spell it nife? hola... but the h is silent. why not spell it ola? There are many, many cases of words like this in English and Spanish. Perhaps other languages too.
So it begs the universal question. Why? Why "silent letters" were ever created? What are the rules for their use when creating words? Why use them at all? Are there any languages that don't use "silent letters?" Has there ever been a historical attempt to rid the language of these words?
Of course you have words like debt, witch, numb, castle... which have "silent letters" within the word itself. why not spelled det, wich, num, or casle? But my primary focus is really on the silent letter at the beginning of a word.
(as an amusing sidenote, you'd be surprised how many times auto-correct changed the words in this message forcing to type over and over again...)
They weren't initially silent or at least without purpose, signaling something about how a word was to be spoken. Pronunciation has changed, leaving the letters as anachronisms of former speech or in the case of borrowings from foreign languages (your pterodactyl example) the spellings reflect the original pronunciation in a foreign language, which did not transfer to modern English even though the spelling preserves the original. The real question is why English does not adopt a system that causes spelling to align with the way we talk. It would be disruptive, but it would be worth it in the long run. Sweden transformed its spelling in this way in the first decade of the twentieth century, and its language is consequently easier to learn. My Swedish-born mentor, Sven Liljeblad (1899-2000) recalled older women complaining about the proposed change because with the new approach to spelling, the poorer classes would be able to spell as well as the upper classes, and there would consequently be no way to make an obvious distinction.
Usually, when a word's spelling doesn't match its pronunciation, it's because originally it did but the pronunciation changed while the spelling stayed the same. In order to avoid massive confusion, we keep using standardized spellings, even unintuitive ones, long after they cease to reflect the word's sounds. This explanation accounts for most of your examples. The word "knife", for example, had the [k] pronounced in Old English, but over time we dropped the [k] from all such words.
English in particular has changed in pronunciation drastically since the time when the modern consensus was established regarding which spellings should be standard, so it's one of the worst languages around in this regard. (Probably not as bad as Irish, though!) This is both because English has changed a lot in just the last few centuries, and also because its spelling system is older than those of many other languages.
The other main way that this kind of mismatch happens is when we borrow a word from a foreign language and we retain a spelling that reflects the source language even though such a pronunciation is not possible in the borrowing language. This accounts for "pterodactyl": it reflects the Greek spelling (πτεροδάκτυλος, according to Wikipedia), but syllable initial [pt] from Greek is not a consonant cluster that exists in English words, so English speakers have adapted the word by dropping the [p].
The actual "rules" (or, rather, patterns) regarding how sounds get introduced or removed from words and from languages are quite complex, too much so for me to get into here. These sound changes are one of the main focuses of the field of historical linguistics. As for why languages change, that is an open question that is hotly debated.
It seems the consensus is that "silent letters" are mostly historical. Are there instances where new words are still created today with "silent letters?" English or other languages?