Start with your highs first. Flatten your EQ. Turn the gains all the way down on your amps. Now, put in the best sounding music you like to listen to. Crank up the volume on your head unit until you hear distortion from your speakers(there is a chance that you may be able to crank it all the way up without distortion). Now back the volume off a notch to good sound again.
If you EQ has a volume knob, make sure it is down all the way while adjusting the head unit volume. Then crank it up until distortion like the head unit.
Now crank up your amp gain until your speakers begin to distort. Then back off a notch. Remember the gain position and turn the gain all the way down.
Now crank up your bass amp gain until you hear distortion from the sub. Back off a bit.
Now turn your head unit down and turn the gain back up on your highs amp.
That's it. Fine tune the gains to your liking.
Thing to remember: Gain controls on amps are not volumes, rather level matching controls. The goal is to reach the maximum output of the head unit, eq, and amps at the same time.
I hope this helps.