What do ._Desktop and ._Library do? In my home directory, there are two files called ._Desktop and ._Library. They have read and write permissions, but cannot be read, even with root.

What do these files do? Is there any way to modify them?
._ Desktop and ._Library contain extended attributes for these directories. This StackOverflow question describes roughly what generic ._ files are.


  if for file foo you have another ._foo, and you're on a Mac, the dot-underscore file is where the file resource fork / metadata is kept.


As to why directories like Desktop or Library would need extended attributes is beyond me, though I would guess it has something to do with appearance and special files.



If these ._ files are appearing on a mounted network filesystem (i.e. NFS) that doesn't use HFS+ on the host server, that is because HFS+ would usually store the information found inside these ._ files along with the file itself. However, since other filesystems do not handle these extended attributes nicely, OS X creates a resource fork that allows your client-side HFS+ filesystem to see extended attributes as if they were part of the file itself.

These files are used in the AppleDouble format which cause the file itself and its pesky counterpart to be merged once the file is taken off the networked filesystem and placed onto a HFS+ filesystem. Deleting these ._file metadata counterparts would usually result in their regeneration the next time OS X processes the file itself.

credit to Tetsujin's comment