pwd output after moving current working directory to a new location
Assuming you're using bash, pwd
is showing you the value of the PWD
environment variable, which is updated when you change directory with cd
. The folder1
directory changing name does not cause bash to update PWD
. However you can find evidence that the directory has changed name:
pwd -P
will show the new name of the directory.ls -l /proc/self/cwd
will link to the new name.
I think it is just the case that the first terminal has no reason to re-evaluate where it is. If you do the following command in the first terminal
cd .
you will see your current working directory has indeed changed per the rename (mv
).