Correct Screw length I should be buying
Just add up all the parts:

Bracket - your questions says &quot;about 1 inches&quot; but I usually find these types of brackets (but haven't used exactly this one) are a bit thinner than 1 inch
Cabinet back - varies, might not be any at all
Drywall or other wall material - typically 1/2&quot;
Between 1 inch and 2 inches into the stud. Studs are nominally 3-1/2&quot; thick, but if there is any possibility of wires going through the studs then you don't want to go more than 1-1/2&quot; in.

So that makes a total of 2-1/2&quot; to 3&quot; typical.
As noted elsewhere, don't use drywall screws. They are handy, but they are not designed to hold a heavy load, which is important for shelving brackets.