As you put things away, prioritize them. Foods you use every day or quite often, like cereals or your favorite tea, should be on the shelf that is most accessible for you.
Group Like Things Together
All the cereals should be together. All the nuts in one place. Keeping like things together makes them easier to find and helps prevent duplicate purchases. If space is an issue and you need to use the full depth of your cupboard, be sure to put tall things in back and short things in front.
Make Use of Vertical Space
If your shelves are too far apart you can buy inserts that add an extra shelf or racks that hang from the back of the pantry door. Add sliding shelves to maximize depth. If your storage is high, find an attractive stepladder that you don't mind having around your kitchen. A whole extra level of storage will suddenly be accessible.
Transfer foods that come in messy packaging into clear containers. Also decant if you have bug problems. Some containers dispense food at the bottom, so if you refill before the container is empty you'll still be using the oldest food first.
Now that you know how to organize your pantry, learn how to maintain it