# Very strange pwd/ln behavior



## MassimoM (Oct 23, 2019)

I have a directory /zfs_p1/storage/cs/projects, and I want to soft-link it in /links.
`#  ln -s /zfs_p1/storage/cs/projects /links/projects`
I find a link in /links.
I enter in /links/projects, and the prompt says /links/projects.

```
#pwd
/zfs_p1/storage/cs/projects
```
it seems ok.

but from normal user:

```
$cd /links/projects
$pwd
/links/projects
$pwd -P
/zfs_p1/storage/cs/projects
```
$man pwd
"
-P      Display the physical current working directory (all symbolic
             links resolved).

*If no options are specified, the -P option is assumed.*
"

What am I doing wrong?
And there is a way to "enter" in the soft-link and "abandon" the /links and really enter the directory /zfs.... , like windows links?
Because if I run "cd .." i will be in /links instead of /zfs_,....


----------



## k.jacker (Oct 23, 2019)

This behaviour is influenced by the shell as well.
If you are using the default /bin/csh shell, then `set symlinks=chase` should give you what you want, if I understand you correctly.


----------



## gpw928 (Oct 24, 2019)

Most shells have a "pwd" built in.  There is also `/bin/pwd`.  They can give different answers.

You have displayed the man page for `/bin/pwd`, but executed shell the builtin.

If you have a Bourne-like shell you can "alias -x pwd=/bin/pwd" (usually in your ~/.profile), e.g.
	
	



```
[ritz.223] $ ls -lad /home
lrwxr-xr-x  1 root  wheel  8 Jul 10 09:36 /home -> usr/home
[ritz.224] $ cd /home
[ritz.225] $ pwd
/home
[ritz.226] $ /bin/pwd
/usr/home
[ritz.227] $ alias -x pwd=/bin/pwd
[ritz.228] $ pwd
/usr/home
```


----------

