Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm a little bit confused with how the 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 can 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 a image in /Applications/XAMPP/xamppfiles/htdocs/narrowcasting/thumb.

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

share|improve this question
    
Could you please give the complete path of the place where you want to place the link and the destination file/folder? (thumb inside thumb?... it is not clear) –  Robert Vila Nov 8 '12 at 22:12
add comment

2 Answers 2

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
share|improve this answer
    
Thanks for your help. I've thought about it again and I think the easiest is if I just place all my files in /Applications/XAMPP/xamppfiles/htdocs/narrowcasting. So for example my index.php will be in ....htdocs/narrowcasting/index.php. A symlink from /var/www/ to the narrowcasting folder should work for this right? I tried: 'sudo ln -s /Applications/XAMPP/xamppfiles/htdocs/narrowcasting /var/www' As far as I can understand if I now go to the domainname it should point me to the index.php in the narrowcasting folder. This is not working. Am I still not understanding it correctly? –  user1737794 Nov 9 '12 at 10:21
    
with that command, you are "mirroring" the contents of /var/www into narrowcasting, you can verify that the link was correctly made by doing "ls" into that directory and verifying that it contains the files you want. where do you have your real files now? –  Sam Nov 9 '12 at 17:24
    
whats the output of "ls -l /Applications/XAMPP/xamppfiles/htdocs/narrowcasting/" ? –  Sam Nov 9 '12 at 17:25
add comment

if you want to create a SOFT or symbolic link from

/Applications/XAMPP/xamppfiles/htdocs/narrowcasting/link-file

to

/var/www/destination-file

yo do:

$ ln -s /var/www/destination-file /Applications/XAMPP/xamppfiles/htdocs/narrowcasting/link-file

Try to use absolute paths because if not, the paths should be writen not from your current directory but from the directory the link-file will be

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.