OSX: Making symbolic links (folder aliases)

If you navigate to /Library/Java, you will notice there's a folder alias in there called Home, which maps to /System/.../Home

If you do an ls -l on the /Library/Java directory, you will see the following:

lrwxr-xr-x 1 xxxx xxxx xx xxx xx xx:xx Home -> /System/.../Home

This is a symbolic link, NOT to be confused with Aliases, and creating one is actually much easier than I thought.

First, to create an Alias, you just right click on a folder, and select Make Alias. This creates a 'shortcut file', not a symbolic link. Case in point, try typing the ls command on the folder shortcut you just made, Terminal will complain that the alias is NOT A DIRECTORY.

To create the symbolic link, you'd type the following:

ln -s /actual/dir/location/ linkname

Now you can ls on the linkname which will spit out the structure for /actual/dir/location/

1 comment:

Dave King said...

An yet in finder it's listed as an Alias. Fell into this trap getting Java 7 to be my default Java. Thanks for helping me back out.