If you're hanging new cabinets on an old wall in your kitchen, you're likely to discover that the walls are uneven, leaning forward or back or just randomly ridged. If you try to use that wall as the guide to square your cabinets as you hang them, they'll end up out of level, out of plumb, or both. For proper look and door function, you need to hang the cabinets square even if the wall isn't. A good level is the most important tool here.
Measure the cabinets along the back, to determine the height and width dimensions of the area that will hang on the wall. Transfer the dimensions to the wall, using your level and pencil to mark out the squares that show the positioning you want. Make sure the top line is level and the side lines are plumb (straight up and down).
Locate and mark the studs in the wall, using your electronic stud finder. Put the marks at the top and bottom of the layout that you drew on the wall.
Measure the wall from each stud mark to the mark that indicates one vertical edge of the cabinet, as it will hang on the wall.
Transfer the marks to the back of the cabinet, measuring inward from the edge and using your level and pencil to draw vertical lines on the back of the cabinet to show where the studs will be.
Drill pilot holes in the back of the cabinet, along the lines that indicate the positions of the studs. Put two holes for each stud line, one foot from the top and bottom of the cabinet.
Reload your drill with a screwdriver bit. Lift the cabinet to the wall, setting it along the marked lines. Install long screws with washers through the pilot holes and through the wall to the studs. Don't tighten the screws completely.
Set your level vertically along the front of the cabinet. Insert shims at the top or bottom of the cabinet, loosening the screws as needed to get the shims in, until your level shows that the front face of the cabinet is plumb. Tighten the screws.
Wear eye protection when using a drill.