is there always a comma before and, or, and but?
Simple answer: no.
In English there are 7 coordinating conjunctions. These are: and, or, but, for, nor,so, yet. These connect words, phrases, and clauses.
When connecting words, there generally is not a comma.
Example: Tom likes to eat bananas and carrots. (And is equally joining 'banana' and 'carrot')
Example: Tom likes to eat bananas but not carrots.
To understand if you put a comma before these conjunctions, you must understand subordination and coordination.
When joining clauses it depends upon whether the clauses carry equal weight (two main clauses) or one is depended (one subordinate clause and one main clause)upon the other.
When it is two main clauses there is a comma before the coordinating conjunction.
Example: Tom went to the store, but he did not buy anything.
If it is a main clause is followed by a subordinate clause there is not a comma.
Example: The teacher sent her students out to play even though it was raining.
BUT, if the main clause is preceded by the subordinate clause, there is a comma after the subordinate clause.
Example: Even though it's raining outside, the teacher sent her students out to play.