It's just the wee knife at hand.
The dirk was the weapon..........basically if you fought against an armed Scotsman you faced three weapons. The claymore in one hand and the targe (small shield, but because of it's relatively lightweight he could be very able with it) strapped to his other forearm with the dirk held below it.
Batter the opponent with the shield, turn the arm and aim the dirk at the throat and when the opponent defends that, use the claymore. Incredibly effective in close combat.
The sgian dubh was the only sharp that men were allowed to carry about their person after the last of the Jacobite uprisings.
There's a third knife, the sgian ochlas. This one was carried hidden down the side seam of the waistcoat or sleeve.
It's from this one that the confusion arises about why the sgian dubh was put into the sock.
It's very discourteous to have a hidden knife about you when you are being offered hospitality, so the sgian ochlas was moved down to the sock so that it was shown that there was no deceit...........but then, you might have two blades to hand in a moment as both socks got tooled up

Socks aren't secure places to carry knives when walking though, tucked inside the body clothing was better.
At the end of the day, the sgian dubh and the sgian ochlas are just the Scottish derivations of the pan European dirk, and we have evidences of those from the Mesolithic.
cheers,
Toddy