Create symbolic link (symlink) to fix OpenOffice.org installation

Q I need to link one directory to another so that if a program asks for directory x, it is shown directory y instead. I've tried ln with various options, but it just keeps creating the link inside the target directory. The reason for doing this is that I've just updated from OpenOffice.org 2.0 to OOo 2.1, which has created a new directory called /opt/openoffice.org2.1. When I click on a text document or spreadsheet in KDE it tries to look inside /opt/openoffice.org2.0, which no longer exists. If I cd into /opt and do

ln -s openoffice.org2.0 openoffice.org2.1

it creates the OpenOffice.org 2.0 symlink to within the 2.1 directory. I've tried everything but just cannot get it to work!

A There are two problems with the way you are using ln. The first is that the syntax is 'ln -s source destination' This one got me too: for some time I had to think twice, having first used links on an OS that used the opposite order. The arguments should go in the same order as they do when you're using cp and mv : I find that helps me remember. The other problem is that if the destination given is an existing directory, ln thinks that you want to create the link inside that directory. This is also consistent with cp and mv, which copy or move into a directory if it is given as the destination. Remove the destination directory and ln will create the link as you need.

ln -s openoffice.org2.1 /opt/openoffice.org2.0

Note that with symlinks, the source is given relative to the destination, so even though this command is not executed in the /opt directory -and therefore no file or directory called OpenOffice.org2.1 exists - the ln command will still work. Alternatively, you could go into the file associations section of the KDE Control Centre and fix it to call the ooffice2 programs with the correct path.

Back to the list