Create a barre with your first finger on any fret. Pretend your finger is the nut of the guitar. Now use your remaining 3 fingers to play an E chord like in the Major chord below. The fingering is a little bit different, but the form is the same.
E Major Open
E Major Barred
(audio example is F major, root on 1st fret 6th string)
Depending on the fret your 1st finger barres determines what chord you
are playing. For example, in an open E chord the open E string is the
root. The E chord barre on the 1st fret is an F chord and so on. This
is where learning the names of the frets comes in handy!
Play the E major barre chord on the 1st fret, then the 2nd, and continue
up the fret board all the way up to the 12th fret. Then go all the way
back down to the open position. The exercise is performed in the audio