#How to make and use symbolic links (also known as soft links) #Written by E Heppenheimer, Fall 2017 #sym links are very useful when data is stored in one directory (for example, and shared directory you don't have write permissions for) #and you want to run analyses based on this data, but in a different directory #and you don't want to have to give the full path to the input file every time #a sym link will make it so the file of interest is functionally in the working directory #that is, you can call it without giving the entire path, just as you would any file stored in the working directory #however, the file isn't actually in the directory (and therefore it takes up no additional space) #The key to a successful sym link is to give the full file path for both the input and the output #technically this isn't alway necessary, so this may feel a bit gauche, but it will save you many headaches if you are in the habit of always giving full file paths #the basic syntax: ln -s /path/to/input/directory/filename /path/to/output/directory #you know your link was successful if you list all the files in the working directory and see this: $ ls -lh filename -> /path/to/input/directory/filename #if this link is nonfunctional, the output will be the same, but it will be flashing (you'll know it when you see it) #typically this means the link is pointing back to itself, and the easiest way to avoid having this happen to is give full file paths! #Sym links can be deleted just as you would any other file: $ rm linkfilename #Deleting the link will not have any impact on the original file!