Thursday, September 27, 2012

How to create symbolic links to files in UNIX

If you have files in a distant folder and you don't want to type their path in terminal when you want to call them make their symbolic links in the current folder:

E.g. for the file /Users/mpjanic/Documents/mm9 genome - Illumina iGenome/Mus_musculus/UCSC/mm9/Annotation/Genes/genes.gtf

use the command ln -s to make the symbolic link
type the path of the file and the file name
and the . to mark the current folder where you want to make the link (or path to any other folder where you want the link to be created)

ln -s /Users/mpjanic/Documents/mm9\ genome\ -\ Illumina\ iGenome/Mus_musculus/UCSC/mm9/Annotation/Genes/genes.gtf .

You can also do the following if you want to make links to multiple files:
 ln -s /Users/mpjanic/Documents/mm9\ genome\ -\ Illumina\ iGenome/Mus_musculus/UCSC/mm9/Sequence/BowtieIndex/genome.* .

All the genome.* files will be linked to the current folder.

No comments:

Post a Comment