I remember hearing that you can't sleep with socks. I think Rambam stated this (correct me if i am wrong), but where in Rambam was it said and why do we do it?
The Gemara (Yoma 78b) writes that one who sleeps with shoes on, 'has tasted a taste of death', and since tasting death is probably not a good thing, some poskim write that sleeping with shoes on should be avoided (see Kaf Hahayyim Y.D 116:211, for example). The book Shemiras Haguf Vehanefesh (no. 115) also writes that wearing shoes to sleep causes someone to forget his learning. However, this rule is never quoted by the Rambam (as far as I'm aware)
Perhaps some people believe that socks are like shoes in this regard, though I personally don't see why that would be the case. The Mishna Berurah 128:18 writes that while Kohanim are not allowed to wear shoes while they bless the congregation, they may (and should) do so while wearing socks - so at least in some respects socks and shoes are not equivalent
מיושב: דאז בהכרח יתגלה גופו והאדם צריך להתנהג בצניעות ובושה לפני הקב"ה ואפילו כשהוא לילה ובחדרי חדרים הלא מלא כל הארץ כבודו וכחשיכה וכאורה לפניו יתברך....ע"כ האנפלאות יראה ללבשם או לפשטם ג"כ תחת הסדין שלא לגלות רגליו שדרכן להיות מכוסות לעולם במדינות אלו שאין הולכין יחף אפילו בקיץ....
That way, a person would reveal his flesh, and a person needs to act modestly wherever he is, even in private, because Hashem is everywhere. Even at night, and in a closed room; for "the world is filled with His glory," (Yeshayahu 6:3) and dark and light are the same to Him....therefore, it would appear that one should put on and take off one's sock under his covers, so that his feet should not be uncovered, for it is the norm in our places to always walk around with our feet covered, even in the summer we never walk barefoot....
( my own translation )
In context, it's clear that the issue with this is because of tzniyus, modest dressing.
[h/t Danno in comments]
Maybe because of this (but this is only for men)
Shulchan Aruch Harav 619.18 (from the Shalo)
...In addition, one should make a point of not covering himself with [so many] blankets and spreads that [his body] will be excessively warmed. One should at least leave his legs uncovered, as alluded to by the uncovering of Boaz’ legs, so that one’s body will not become excessively warmed.
Additional sources regarding shoes, sandals and slippers (but not socks) include:
- Rav Yosef Haim of Baghdad, in Parashat Pinhas Shana Sheniya, 16
- Rav Haim Kanievsk
There is also a disagreement on the length of sleep required for this to be a problem.
The Beis Yosef brings that talmidei chachomim keep their shoes on the entire week. The Taz also brings this Sefer Haterumah.
כתוב בס' התרומה ומורי מפרש מנעל של ת"ח שקושרים בחוזק רצועות מנעליהם ולומדים בלילות ואינם חולצים מנעליהם ולא פושטין לבושיהם כי אם משבת לשבת
Seemingly, the students did not mind the "Taste of Death". (see the answer of הנער הזה)