Linen is a fabric made from the flax plant. Naturally creamy white to a pale tan, modern processing can also produce subtly coloured blues, greens and yellows, but such processing does not appear to have been known in medieval times. The shorter flax fibres are called tow and the longer ones, line. The line are used to make fine cloth, tow to make coarse cloth, and also unspun as a stuffing material.
Linen doesn't take or keep dye well, due to its silkier fibres. That means it uses more dye to achieve the same colour as silk or wool, and loses the colour more rapidly. Therefore most linen was used bleached white or off white. One exception to this is blue dye from woad or indigo which sits on the surface of fibres, rather than soaks in. The Vikings definitely used madder (red linen) as well as woad (blue linen) in clothing (possibly only for special occasions or burial). This, however this is a rare usage compared to other times and places.
This silkier property of linen fibres is also supposed to make it more difficult for dirt and other stains to stick to linen, making white linen easier to keep clean. Linen can also be bleached. For these reasons white or unbleached linen was the favoured, and most common material for underwear for both medieval men and women. Hemp, Nettle cloth and Ramie may have been used as cheaper alternatives in some times and places. Cotton was used extensively in the Middle East, but was never as common as linen in Europe, as it has shorter, harder to spin fibres and produces a weaker cloth.
There is also some mention of "blackened linen" in some period texts, generally as a material used for making armour (specifically gambesons). It is assumes that this is some kind of waterproof material (used by sailors etc), but no-one is sure exactly how the linen was blackened (e.g. tar, pitch, charcoal, a bog).
What was linen used for?
Coloured linens become more common in non-clothing items. For example embroideries and bed cushions need to be washed and exposed to sunlight less often, and thus remain more colourfast. One cushion was painted with red paint to achieve as strong colour. Silk appears to have been the favoured material for colourful backgrounds of embroideries, when it could be afforded, but linen was preferred (presumably being easier to work with) where it would be completely covered by embroidery.
Linen only used for outer garments in a limited number of times and places. Linen is superior to cotton and wool for its ability to hold pleats and be starched stiffly. It was very probably the fabric used for one variety of 12th Century dress called the chainse, which was known for its heavily pleated appearance, and was most commonly white. Silk is reputed to hold pleats well, but was many times more expensive than linen.
Linen is cool in summer (cooler than almost any other natural fibre) and warmer in winter than cotton. You can tell real linen in the shops - crinkle it up in your hand, then release it. Cottons will have a few creases, but linen will have lots. Linen will also feel a lot cooler on warm days to your hands, and will quickly warm up to your hands on cool days.
Sewing with Linen
Linen garments were generally sewn with linen thread - it was cheaper than silk, and silk threads might eventually wear holes in the fabric as it is easier to resew a seam than replace a garment. Wool garments were also sewn in linen thread, but wool thread for this purpose was slightly more common.
Coloured linen threads were generally considered a poor alternative to the much more colourful silks for embroidery, but white linen threads were very popular with even the richest embroiderers, and were the preferred thread for whitework.
Many items in the fabric shops are labelled "linen look" or "fancyname linen", that are actually synthetic fibres - read the fine print carefully. Modern fashion linens are also deliberately woven coarse (like hessian bags) and slubby. Such fabrics would have been the cheapest linens on the medieval market - nobles would have been buying much finer linens with thread counts of 15-40 threads/cm. Such fashion linens are also generally spun on mills designed for the shorter fibre length of cotton. The linen fibres are often chopped shorter for use on such spinning mills, thus they lose the advantages of stronger threads that come from long fibres.
Some people think that newly purchased linen tends to shrink a lot, so make sure you prewash and dry it at a slightly higher temperature than you will normally use, once or twice before you cut out garments from it. Linen used in period garb doesn't need dry cleaning or ironing - after a few washes it will get softer and most creases will fall out. The Vikings did however use a device like an iron - a glass ball which was used (cold) on linen fabrics. This was probably used not to remove creases, but to polish the fibres of the linen, giving the surface of the garment a sheen.