Monday 21 November 2011

Making Symbolic links on Mac OS X through command line

So, I keep having to refer back to this, so instead of looking through old posts which mention it, I thought I'd make a post dedicated to Symbolic links.

So, to make a symbolic link it is simply:

ln -s /pathtoexistingfolder/ /pathtofolderyouwantsyboliclinkin/

Simple. Of course many occasions call for you to use the command line to check whether a folder is a symbolic link. To do this I use this command:

ls -l ~/Library/

If a folder in this list starts with an 'l' it means it is a symbolic link. I run this command to check whether the Caches folder is a symbolic link:

ls -l ~/Library/ | grep 'Caches'

What comes up if it is a symbolic link is:

lrwx------ 1 330986 wheel 19 Nov 21 11:37 Caches -> /tmp/330986/Caches/

Notice the "l" at the begining, and also the " -> " which then tells us where the symbolic link goes to.

No comments:

Post a Comment