First thing to know: don't do this. Strong spin cycles and hot water are poison for linen. You've already seen it happen to your pants. But don't get paranoid about everything people say about taking it out wet and that's it, because you do need some drainage or it'll be dripping for days. The key is finding the balance.
Wash in cold or lukewarm water (never hot), on a gentle cycle with no spin, or with a very gentle spin if your washing machine allows it. When it comes out, squeeze it carefully: wrap it in a clean towel and press without wringing, or let it sit on the towel for a few minutes. Then hang it up wet but not dripping. While it dries, smooth it out with your hands every so often if you see it getting wrinkled. Linen stretches a bit when it's damp, so take advantage of that moment to straighten it out before the drying sets in.
Oh, and use little detergent. Linen doesn't need much to get clean, and fewer products means fewer residues that'll make it stiff. Some people say a bit of white vinegar in the final rinse does it good, but being honest, if you use moderate detergent it's not essential. What does work is always hang-drying, never the dryer. Linen and dry heat aren't friends.