A minced oath, an expression of dismay, disgust, anger, surprise etc.
Used like "what the hell" to add emphasis.
A mild admonishment.
A greeting.
Used to move or return to another subject of discussion.