The Chromatic Warm Up is a classic exercise: every guitarist has at least done it once, and it is highly recommended to include it as part of a daily routine. It basically involves playing an ascending run of chromatic notes as shown below:
When you reach the fourth note on the high E string, you just halft a tone up by sliding your finger, and go back to the low E string in the reverse order. Then move on to the third fret, etc.
As for the right hand, this exercise can be done using alternate picking or, if you play finger style, alternating index and middle fingers. Whatever the technique you use in the right hand, it is important to keep it strictly controlled: that way the exercise will be serving the double purpose of warming up your left hand and getting your right hand/left hand coordination up to scratch. If something doesn't sound correct (maybe you're picking in one direction only, or your right hand nails sound uneven) it is better to stop and correct that, to avoid repeating the same mistake again and again.
There are multiple variations on this basic exercise. You may want to try the following order:
I. Start really slowly, play the first F note and let it ring clearly for at least two seconds before going up a fret. When you press the following fret, your left index finger should rest on the first fret without moving. As you go up, your fingers should rest where they are until they have to move again: it is essential to avoid unnecessary hand movement, as it will greatly hinder your speed, acurracy, and stamina. Practice this way for a couple of minutes, letting every note ring and concentrating on keeping your movements to the minimum.
II. After that, you can try adding additional stretches between fingers, as shown below. Try these for a couple of minutes also.
III. Set your metronome slow (at 60, for example) and start playing as below, with each click of the metronome corresponding to a note. Once you feel confident you can go up in speed (but not too fast), always making sure that every note sounds crystal clear. You may want to add a little acent to the first note of eachgroup of four: it is a good way to create a reference point to avoid 'getting lost' when you reach high speeds, so it's better to incorporate in early on. In any case, you don't want to reach extreme speed in this particular exercise, but rather acquire a flowing sound and watch closely the movement of your fingers, trying to keep it down to the minimum possible
IV. Now you can add stretches to the exercise. Watch out for that difficult stretch between the ring and middle fingers, it will probably slow you down.
V. Once you've got the hang of the exercise, you can start playing more than one note per beat of the metronome. Start with eight notes and eventually try with sixteenth notes, always keeping the accent on the first of every four notes. Remember that right now this isn't about speed but the intelligibility of your sound.
VI. A popular variation on this exercise involves starting the pattern on each string with a different finger. This helps build hand independence.
Every warmup should have the double purpose of preparing you for practice or playing, while at the same time consolidating your technique. These chromatic runs are actually an excellent tool to build speed. You are encouraged to come up with new patterns and try them out all the way up the neck of the guitar. Start pushing the metronome by 4 points every time, and check that every note you play sounds clear and differentiated from the last one. For an additional challenge, try to do some of the exercises starting with a upstroke: this is a way of tweaking old exercises into something new, and it serves as preparation for multiple situations you may encounter when playing.