Ubuntu – Help with creating a symbolic link

symbolic-link

I'm confused with how symbolic links work. I hope someone can guide me in the right direction.

I want to put a demo online from our software, which normally only runs locally on a Mac Mini. So I put all the files in the var/www from my Ubuntu 12.04 server installation.

There are a lot of hardcoded links in the software which point to /Applications/XAMPP/xamppfiles/htdocs/narrowcasting

Of course, I could change all these code on my html/php files in /var/www, but that would be quite annoying. I hope I can fix this by creating a symbolic link. For example, I have a directory called thumb in /var/www/thumb. The PHP code is trying to put an image in /Applications/XAMPP/xamppfiles/htdocs/narrowcasting/thumb.

Can anyone give me a tip how to achieve this with a symbolic link?

Best Answer

use the ln command to do symbolic links.

 ln -s <real folder> <link folder>

in this example, you will create link folder that will actually contain what real folder have, and if you save something to link folder it will actually save it into real folder

You can verify the link with the command ls -l which will show an arrow to where the link points.

Note that the folder containing the link must exist, so you would have to create it first.

So in your situation, the commands that you are looking for are

sudo mkdir /Applications/XAMPP/xamppfiles/htdocs/narrowcasting

sudo ln -s /var/www/thumb /Applications/XAMPP/xamppfiles/htdocs/narrowcasting/thumb

Again, you can verify that the link was actually made with

ls -l /Applications/XAMPP/xamppfiles/htdocs/narrowcasting/thumb