Linux and OSX: Create a Symbolic Link

‘Symbolic Links’ in Linux are pretty much the same as ‘alias’ files or ‘shortcut’ files in OSX and Windows respectively. And you can create them just as easily in any Linux Gui by right-clicking on a folder or file. However, creating or moving a symbolic link to a location outside of your user folder usually involves being the ‘super user’ or using ‘sudo’. It’s so simple to do with the Terminal, I can’t see trying to work around within the gui. So, I hope you find this helpful.

I found this info here thanks to a good friend:

http://help.hardhathosting.com/question.php/95

It’s such a good note to keep around that I wanted to have it on my own site.

In the Terminal enter the following:

ln -s [TARGET DIRECTORY OR FILE] [SHORTCUT]

For example:

ln -s /xampp/htdocs/work /Users/username/xamppwork

This points a symbolic link located in your home folder (xamppwork) to “/xampp/htdocs/work”

I am finding this to be very useful for using XAMPP to develop dynamic sites or to work the bugs out of WordPress themes. I have my working folder inside my Documents directory and then place a symbolic link to that folder inside the XAMPP server’s ‘htdocs’ directory. Pretty slick.

2 thoughts on “Linux and OSX: Create a Symbolic Link”

  1. In Windows 7 it’s crazy simple (and logical) to create a “Library” that points to multiple folders via the GUI and that is infinitely preferable to typing arcane commands in Terminal. So, how about a GUI solution.

  2. Hi Roj,

    I actually had to go read up on what “Libraries” are in Windows 7. When helping Windows friends fix problems with their systems I have noticed those elements in the sidebar. I never knew what they were, but it’s a neat idea to incorporate that capability into the file manager/browser. However, you’re the first Windows user I’ve met that knows what they are!

    I am kind of baffled about Microsoft’s decisions with the file manager. There’s way too much going on there for most people’s needs. For instance, the Libraries section is very prominent in the sidebar, even if it isn’t being used. Why?

    Regardless, in Linux and OSX – as far as I know – this sort of virtual folder that displays content from multiple different real folders isn’t part of the file manager outside of using the search tool.

    However, that functionality is used in various Music & Video library programs, Photo organizers and also Document organizers: iTunes, Banshee, Rhythmbox, iPhoto, Shotwell and the Gnome team’s new “Documents” program. But I don’t personally have a need for the feature, so I’m afraid I can only be of so much help.

    Also, there is a way to generate symlinks in the GUI: in Linux and OSX just right-click on a folder and select “Make Link” or something like that. It will give you a folder with a little “link” icon on it. Move the link to wherever is handy and double-clicking on it will show you the contents or the original folder.

    I hope this is helpful.

Comments are closed.