You should be able to find an expiration date on the package. The quality may be less after this date but still be usable. Fats go rancid and will make things taste bad. Walnuts seem to be quite sensitive. Almonds less so. On one trip a friend ate 2-year past-date Raman noodles and got sick. Cool, dry and dark is the best for storage. Under these conditions you could easily eat stuff past its expiration date. Also, grains (rice and such) tend to get weavils when stored a long time. Once you break the seal on freeze dried food (such as sealed containers of f.d. fruit that I buy at Whole Foods) it quickly absorbs moisture.

My rule of thumb is to get new food at the beginning of each backpack season. I do not keep emergency food in my car due to the potential for bears to tear into my car.