The notes near the nut of the guitar are...
Similar patterns can be found elsewhere on the neck. An abbreviated scale based on five notes (pentatonic) is often used as the basis for blues and rock guitar licks. Move up to the fifth fret and run down this scale... then back up. Then just part way through and back... etc...
The numbers on these diagrams indicate which finger should be placed in which fret.
A similar pattern can be played up a few frets...
If you observe carefully, you will see how the left half of the second scale is a repeat of the right half of the first scale. Indeed, you can play runs from one through the other.
The Blues Scale is an abbreviated form, the pattern for the full set of notes in the 4th fret looks like this.
I'll leave it to you to figure out the fingering. The guitar was developed for people with four fingers; you should use all four. You can do it with three, but in the end you will be faster and it will be easier if you use all four.
Practice this pattern starting in the fifth fret.
Likewise, in the 7th.
Lastly, in the 10th fret. (it starts all over again in the 12th).
As you play these scales you will be developing both dexterity in your fingers and developing your ears to hear the steps. You will find that the notes in chords are based on the notes in their respective scales.