简体   繁体   中英

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

I have a folder in my home directory called ~/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.

You can use "pwd -P" instead, avoids all symlinks and prints the "real" path

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

If you just want to get into the folder with a shorter name, either tabcompletion or aliases are your friends.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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