Monday, September 17, 2007

Symbolic Links

For some reason I have a mental block on how symbolic links work and have to do a Google search every time I want to create one. Maybe if I write a post about it, I'll break the block or at least have a handy reference for when I forget again.

According to Wikipedia, a symbolic link is a special type of file that points to another file. The difference between a symbolic (or soft link) and a hard link, is that if the user removes a symbolic link, the file it points to is unaffected, whereas if the user deletes a hard link, the original is deleted as well. The flip side according to these folks is that with a symbolic link if the original file is deleted, the link file is unusable. With a hard link, if the original is deleted, the link file preserves the data.

So here's how to create a symbolic link:
ln -s original_file link_file

Replace original_file with the name of the existing file you want to make a link to and replace link_file with the name of the file you want to point to the original file.

No comments: