This is more of an English question than a Christianity question, but the basic principles are:
- Capitalize Satan, Lucifer, Devil, Evil One, Father of Lies, etc., when used as a name or title of a specific being.
- Do not capitalize when used in a general sense, or when using it as an expletive.
It may be helpful to consider the example of the word "mother" in English: we'd say, "his mother is going to the store," but, on the other hand, "I'd like to go to the store, Mother." In the first case, it's not a name, but it is in the second. However, if the sentences were changed to "The girl Mary is going to the store" and "I'd like to go to the store, Mary," we capitalize both times, because "Mary" is always a name.
Now, to the examples. The KJV always capitalizes the word "Satan". Same thing for Lucifer. These the KJV considers to be clearly names. But, "devil" is different: most of the time, it is not capitalized. It's generally used like the word "mother," or "demon"—not a name, but a simple noun.
That's how it's used in Luke 4:2. If you click the link, you'll see that some translations take a different approach: it can be a judgment call.
In other cases, it's more clear: in Revelation 12:9 many translations capitalize "Devil" (note the phrase, "called the," indicating that it's a name):
And the great dragon was cast out, that old serpent, called the Devil, and Satan, which deceiveth the whole world (KJV)
Similarly, in John 6:70, all translations use lower-case "devil" because it's very clear that the text is not referring to Satan himself:
Jesus answered them, Have not I chosen you twelve, and one of you is a devil? (KJV)