Underhooks are a good bet no matter where you are. And never let your elbows come away from your body.
Those 2 basic rules will keep you pretty safe

More specific:
Guard - If you have a underhook on one side he cannot pass on that side. Tight overhooks are nice too. But really, it is your legs doing more to control him from here so worry about them. Most beginners tend to stick to a closed guard, if that is the case start climbing up his back with your legs, they whould be what is holding him down.
Side mounted - The side on his hips, keep the elbow under him. If it goes up beside his hips he can attack it. The other side - either outside his arms with your elbow in, or applying pressure across his throat with your elbow in. Don't reach over his shoulder or straighten your arm.
In guard - Control his hips, head or biceps.
Mounted - Elbows have to stay in, If he gets his knee wedged into your armpit and brings your elbow up he can attack it. You can also stall a bit with a body lock and tucking your head up, but you should be looking to either elbow escape or overhook a arm tightly and bridge.
Anyways, commone themes are obviously elbows in and go for under/overhooks. Other things might come in later... ok, they will, but for now that should be it. Best to keep things to simple rules that apply almost anywhere then trying to look at very specific scenarios.