我想在Linux中创建一个符号链接。我编写了这个Bash命令,其中第一个路径是我想要链接到的文件夹,第二个路径是编译的源代码。

ln -s '+basebuild+'/IpDome-kernel/kernel /home/build/sandbox/gen2/basebuild/IpDome-kernel/kernal 

这是正确的吗?


当前回答

ln-s源路径链接路径名

注:

-s生成符号链接而不是硬链接

其他回答

在Linux上创建符号链接或软链接:

打开Bash提示符并键入下面提到的命令以创建文件的符号链接:

A) 转到要创建软链接的文件夹,然后按如下所述键入命令:

$ ln -s (path-to-file) (symbolic-link-to-file)
$ ln -s /home/user/file new-file

B) 转到新文件名路径并键入:

$ls-lrt(查看新文件是否链接到该文件)

例子:

user@user-DT:[~/Desktop/soft]# ln -s /home/user/Desktop/soft/File_B /home/user/Desktop/soft/File_C
user@user-DT:[~/Desktop/soft]# ls -lrt
total 0
-rw-rw-r-- 1 user user  0 Dec 27 16:51 File_B
-rw-rw-r-- 1 user user  0 Dec 27 16:51 File_A
lrwxrwxrwx 1 user user 31 Dec 27 16:53 File_C -> /home/user/Desktop/soft/File_B


Note: Where, File_C -> /home/user/Desktop/soft/File_B  Means, File_C is symbolically linked to File_B
ln -s source_file target_file

http://unixhelp.ed.ac.uk/CGI/man-cgi?ln

要创建符号链接/软链接,请使用:

ln -s {source-filename} {symbolic-filename}

例如。:

ln -s file1 link1
ln -s TARGET LINK_NAME

其中-s使其具有象征意义。

ln -s target linkName

您可以在此处查看手册页:

http://linux.die.net/man/1/ln