1

I am trying to make a symlink so all documents are on a different harddisk drive. I learned how to make a symlink and tried to create the desired symlink. this is the command I used in terminal:

ln -s /media/Schijf-2/Nel/Mijn Documenten/ ./home/nel/Documenten

However, I receive an error message:

ln: target '.home/username/Documenten' is not a directory

I found similar questions but I do not understand what I did wrong:

https://askubuntu.com/questions/465493/how-can-i-symlink-my-home-folder-from-another-drive

Create a symbolic link relative to the current directory

I tried to symlink my /home/<user>/Documenten directory to /media/Schijf-2/Nel/Mijn Documenten.

How can I succeed?

  • 1
    Actually, I suspect your problem is the initial period -- ./home/nel/Documenten starts from the current directory rather than the filesystem root. – Shadur Nov 15 '14 at 16:43
1

There are a few problems with your command. You ran

ln -s /media/Schijf-2/Nel/Mijn Documenten/ ./home/nel/Documenten

This means "create a link called Documenten that points to /media/Schijf-2/Nel/Mijn Documenten/. Because of the space, the ln command was given Documenten and not ./home/nel/Documenten as a target. One of way of dealing with this is to quote the name (see here for more information):

ln -s /media/Schijf-2/Nel/"Mijn Documenten"/ ./home/nel/Documenten

The next issue is that apparently, there is already a file (and not a directory) called Documenten in your current directory which is why ln complains:

$ ls
file.txt
$ ln -s /tmp/ ./file.txt/
ln: target ‘./file.txt/’ is not a directory: Not a directory

So, to do what you actually wanted to do you will need to delete or rename the Documenten file:

$ mv Documenten Documenten.old

Then, run this command to create a link:

$ ln -s /media/Schijf-2/Nel/"Mijn Documenten"/ Documenten
  • Can it be a problem that the /home/<user>/Documenten directory is a standard directory which is install automatically when a user is added? – DutchArjo Nov 16 '14 at 13:23
  • @DutchArjo I don't see why, no. It should make no difference as long as the directory (or a link to a directory) exists. – terdon Nov 16 '14 at 13:29
  • 1
    @DutchArjo - the proper way to relocate User Dirs (e.g. Documents, Pictures etc) is via the config file user-dirs.dirs, see here. – don_crissti Nov 18 '14 at 6:25
  • thanks. That is exactly what I wanted to do indeed! When you would post that as an answer, I can accept it... – DutchArjo Nov 18 '14 at 19:17
  • @terdon thanks, I now have succeeded in creating the symlink. I did not understand that I had to be in the /home directory to create a symlink to a different location there. I now have the symlink, and 'cd-in' into this symlink brings me exactly to the right location. – DutchArjo Nov 18 '14 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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