I want to make a symbolic link in Linux. I have written this bash command where the first path is the folder I want link into and the second path is the compiled source.
ln -s '+basebuild+'/IpDome-kernel/kernel /home/build/sandbox/gen2/basebuild/IpDome-kernel/kernal
Is this correct?
Creating Symbolic links or Soft-links on Linux:
Open Bash prompt and type the below mentioned command to make a symbolic link to your file:
A) Goto the folder where you want to create a soft link and typeout the command as mentioned below:
$ ln -s (path-to-file) (symbolic-link-to-file)
$ ln -s /home/user/file new-file
B) Goto your new-file name path and type:
$ ls -lrt (To see if the new-file is linked to the file or not)
Example:
ls -lrt
lrwxrwxrwx 1 user user 24 Aug 6 23:40 new-file -> /home/user/file
Note: Where, A -> B Means, A is symbolically linked to B
If you are in the directory where you want to create symlink, then ignore second path.
It will create symlink of
target
insidemyfolder
.General syntax
To create a symbolic link /soft link, use:
e.g.:
I find a bit confusing the terminologies "target" and "directory" in the man information.
The target is the folder that we are symlinking to and the directory the actual symlink (not the directory that you will be symlinking to), if anyone is experiencing the same confusion, don't feel alone.
This is my interpretation of creating a Symlink (in linux):
You can navigate to the folder where you want to create the symlink and run the command or specify the FULL PATH for your symlink instead of NAME-OF-YOUR-SYMLINK.
OR
I hope this helps to those (still) slighly confused.
(Because an ASCII picture is worth a thousand characters.)
An arrow may be a helpful mnemonic, especially since that's almost exactly how it looks in Emacs' dired.
And big picture so you don't get it confused with the Windows' version
Linux:
Windows:
You could also look at these as
The
from-here
should not exist yet, it is to be created, while theto-here
should already exist (IIRC).(I always get mixed up on whether various commands and arguments should involve a pre-existing location, or one to be made.)
EDIT: It's still sinking in slowly for me; I have another way I've written in my notes.
Where the
-s
makes it symbolic.