In the naval services going back to the founding of the Continental Navy unbridled swearing has been frowned upon. Above are pages from a Continental set of rules for the Navy. In that Navy the commanders censured cursing about God or the Naval Commander (who is God when he commands a ship). Through the last two centuries the protections for the commander have remained in place but the Almighty is tasked with protecting His or Her own name. Military personnel of all branches have had and continue to have an affinity to colorful language. However, it always has been frowned upon from the lower ranks and has found its Rembrandts mainly in its non-commissioned officers. Occasionally officers do seem to find the right chords in this symphony.
So sailors do swear "like sailors" but if they do it in front of the Boson or Chief there are likely to be unpleasant repercussions. If they do it before higher ranks there will be H*ll to pay. "Belay that talk and save it for shore leave."