简体   繁体   English

如何进行符号链接,但cd应该显示物理目录名称

[英]How do I make symbolic link but cd should show physical directory name

I have a folder in my home directory called ~/bestphotosever 我的主目录中有一个名为〜/ bestphotosever的文件夹

So I make a symlink as follows: 所以我做了一个符号链接如下:

cd ~
ln -s bestphotosever bpe
cd bpe
pwd
#-- here is what pwd shows
--> /home/myuser/bpe

#What I would like it to show is the physical name
--> /home/myuser/bestphotosever

Any ideas how to do this using 'ln' command. 任何想法如何使用“ ln”命令来做到这一点。

You can use "pwd -P" instead, avoids all symlinks and prints the "real" path 您可以改用“ pwd -P”,避免所有符号链接并显示“真实”路径

edit: I just realized i might not have answered your question. 编辑:我只是意识到我可能没有回答您的问题。

Are you sure "you want" a hardlink? 您确定“您要”硬链接吗? Some info on hard link vs symlink. 关于硬链接和符号链接的一些信息。 https://askubuntu.com/questions/210741/why-are-hard-links-not-allowed-for-directories https://askubuntu.com/questions/210741/why-are-hard-links-not-allowed-for-directories

If you just want to get into the folder with a shorter name, either tabcompletion or aliases are your friends. 如果您只想使用较短的名称进入文件夹,则tabcompletion或别名是您的朋友。

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

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