I know it's been asked many times, but I followed the instruction and cannot create the link. The symlink (gradle-current) always ends up inside the target (gradle-2.7)

cd ~
ln --symbolic -t /home/tung/gradle-2.7/  /home/tung/gradle-current/

or other version:

cd ~
ln --symbolic -t gradle-2.7  gradle-current

still no luck, any tip? Thanks

  • What is your desired end result? The -t flag is working as it is supposed to, from what you say. Where did you want the link to be and where did you want it to point? – Wildcard Oct 4 '15 at 7:58
  • I want the gradle-current link to point to gradle 2.7 folder – EyeQ Tech Oct 4 '15 at 7:59

-t specifies a directory in which to create a symlink. It doesn't specify a directory which is to be targeted by the symlink.

What you want is ln -s gradle-2.7 gradle-current. This creates a symlink called "gradle-current" which points to "gradle-2.7".

In actual fact it doesn't matter whether gradle-2.7 is a directory or a file—the command is the same.

Actually, it doesn't matter if gradle-2.7 exists or not, the command is still the same for creating the symlink. (The symlink won't work if the target doesn't exist, but it can still be created. If the target is later created, the symlink will then operate without any additional work.)

  • the target does not even need to exist ... the command is the same – Skaperen Oct 4 '15 at 8:18
  • @Skaperen: Good point, I added that to my explanation. :) – Wildcard Oct 4 '15 at 8:25

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.