I can think of many much worse ways for a superior to tell his employee to put a sock in it, and the bosses I've had often choose these worse ways. Odds are decent, from the info we have, that the employee was being more of a jerk than the boss. If so, the boss's irritation is understandable, and he's only human too.
However, it is a bit rough and dismissive. Being right when the other person is wrong is an art form. As such, it requires wisdom, practice, and ultimately a desire to be bigger than the problem. Just because a boss is a boss doesn't mean they get to act bossy, if you follow me. A true leader does a lot more knowing that you'll do things right than making you do things right, which requires setting a good example, as well as choosing the right employees for the right jobs. A good boss can exercise authority without getting in someone's face, except in the most extreme situations, which often are the boss's fault anyway for not fixing them before they became extreme. There are times to put boots in asses, but even that can almost always be done properly and respectfully.
Definitely NEVER say anything anywhere near this to someone on the same level. Not only will you be a jerk, but you'll gain a rep as a jerk. And if you're asking, that's obviously not what you want.