From the Rolling Stones tune " (I Can't Get No) Satisfaction
This is based on a blues shuffle in E - which I'm fairly sure is how the Stones came up with the riff.
However on the original song the lead guitar just plays the top notes and the bass guitar gets the E notes underneath.
If you just play the top notes on their own it doesn't sound quite right, which is why I have played it this way.
This is a basic blues / rock technique which can be used many different ways.
To start put your 1st finger on strings 4 and 5 at the 2nd fret , keep it there , and stretch with your 3rd finger to get the notes at the 4th fret.
Use your little finger to get the notes at fret 5.
Try to keep your 1st finger in place throughout with the exception of the very last beat where it comes off briefly to kick the riff off again.
I have tabbed out one complete riff.