Because of the high fat content of nuts, they are very susceptible to going rancid, so frankly, you’re nuts if you don’t keep them in the freezer or at least the refrigerator. Light, heat, moisture, and the presence of metal conspire to spoil nuts, so they are best stored in sealed plastic or glass containers in a dark, cool, dry place. The freezer is ideal, and doesn’t harm the nuts at all.
Nuts also quickly absorb odors from their surroundings, which is another argument for keeping them in isolation in cold storage.
Peanuts, pecans and walnuts are most susceptible to spoiling, while almonds and cashews are among the least. Nuts keep for approximately twice as long in the shell as they do shelled. A good rule of thumb is that a fresh nut will keep for four months in the refrigerator and eight months in the freezer. Of course, you generally have no idea how fresh the nuts you buy are, so you should try to buy them from a busy store that turns over lots of product frequently.
Rancid nuts will ruin whatever you put them in, so be sure to taste a sample before you add them to a recipe.