Assuming these are open packets that have been open for a while - you probably have a mite infestation, probably the flour mite (Acarus siro), or a closely related mite. These are tiny almost-invisible-to-the-naked-eye members of the Acari, which is an animal order including the ticks and mites.
They are very small - between 0.33 and 0.66 mm (0.013-0.026 in), with translucent/whitish bodies and pink legs. They are, as the name suggests, most commonly found in flour, but are also seen living on a range of grains, cereal products, dried fruit and nuts. They can promote allergic reactions upon consumption of food contaminated with the mites.
Because they are so small, detection is difficult and usually not noticed until fairly heavily infested - if you are seeing the dust/flour/whatever move, then you most likely have a heavy infestation. You may be able to find them on the food or in your cupboards with a magnifying glass or using a piece of sticky tape to press down on cupboard surfaces, then examining it under bright light.
Severely infested foods should be discarded, but the mites can be killed by freezing the affected food-stuffs for 7 days. Just be aware that this will not kill off any antigens from the mites - they can still cause an allergic reaction upon consumption. They are difficult to eliminate because they are so small, but you can thoroughly clean your cupboards and any food storage containers with regular house-hold cleaners to get rid of food residues that they use as a food source.
There's a more detailed version of the above advice on wikihow.