What did I do wrong while creating a symbolic link to /tmp?

$ sudo mkdir /mnt/tmp/
$ ln -s /mnt/tmp/ /tmp/
$ ls -alh /tmp
total 12K
drwxrwxrwt  3 root   root   4.0K Sep 28 05:29 .
drwxr-xr-x 23 root   root   4.0K Aug 26 05:44 ..
lrwxrwxrwx  1 ubuntu ubuntu    9 Sep 28 04:53 tmp -> /mnt/tmp/
drwx------  6 ubuntu ubuntu 4.0K Sep 28 04:54 tmpDcI8v2
  • 2
    you made a symlink in /tmp to /mnt/tmp. Did you actually want to make a symlink from /mnt/tmp to /tmp ?
    – Zanna
    Sep 28, 2016 at 5:47
  • I wanted to make a symbolic link from /tmp to /mnt/tmp.
    – user977828
    Sep 28, 2016 at 8:54
  • then you did it right :)
    – Zanna
    Sep 28, 2016 at 8:57

1 Answer 1


Nothing went wrong. You used the 3rd form of ln syntax:

You ordered to create a symbolic link to /mnt/tmp and place it in /tmp.

As /tmp is an existing directory, system will create the link with the same name as the target, i.e. tmp inside that directory.

You end up with a symbolic link /tmp/tmp pointing to the /mnt/tmp which is what you see in the directory listing.

There are two things that might have confused you:

  • the order of arguments in ln is: first the target, then the link name
  • if you provide an existing directory instead of the link name, ln will create a link inside that directory

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.