If I am in a directory /foo, and I move (from a different session) /foo to /bar. If I then go back to the session in /foo and run ls, the files are still there, and I can see new files if they are created there. Then I can execute cd . for the current working directory to be updated in the prompt and in the output of pwd. How does my shell know that the directory has been moved?
Asked
Active
Viewed 46 times
0
retnikt
- 319
- 3
- 7
-
1You may find the answers to this questions useful: [What is $PWD? (vs current working directory)](https://unix.stackexchange.com/questions/174990/what-is-pwd-vs-current-working-directory) – cherdt May 10 '20 at 16:09
-
Is the new path `/bar/` or `/bar/foo`? In the first case it is not a move but just a rename. – Hauke Laging May 10 '20 at 19:21
-
The two sessions are each running in separate processes, and each session has a current directory. – glenn jackman May 11 '20 at 03:11
-
@HaukeLaging yes I suppose in this case it would be a rename – retnikt May 11 '20 at 07:25