简体   繁体   English

如何在Linux上的目录中使用“ ln”创建链接?

[英]How to use “ln” create link for directories on linux?

I tried linux command line "ln", seems it couldn't do this: 我尝试了Linux命令行“ ln”,似乎无法做到这一点:

mkdir -p test1/test2/test3
ln -s test4 test1 #I wish to create test4 as symbolic link to test1
find test4

The result is weird: 结果很奇怪:

$ls test1
test2 test4

Well, test4 is a subdirectory of test1, not a link to test4. 好吧,test4是test1的子目录,而不是test4的链接。

It didn't achieve what I expected. 它没有达到我的预期。 How should I achieve this? 我应该如何实现呢? Thanks a lot. 非常感谢。

You change the position of arguments ln [-fiqRrv] old new . 您可以更改参数ln [-fiqRrv] old new The first position is original file/folder e the second is the symbolic link. 第一个位置是原始文件/文件夹,第二个位置是符号链接。 Try this, that will create a symbolic link in test4 to test1 尝试此操作,这将在test4创建到test1的符号链接

ln -s test1 test4

more in : ln documentation 更多内容: ln文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM