knows which side his bread is buttered on

If someone warns you to know which side his bread is buttered on they are trying to tell you to be careful not to upset people who you know can help you. The reason for this idiom is to say that if there is someone who can aid you or help you or provide a benefit to you in some way, you should not judge, insult or upset them otherwise they will not help you in return.