Terminal directory delete issue I don't really know what it is called but it was an issue for me.

So here is what I was doing:


Created Directory with content and have it open in finder
Open a terminal and go to the same directory.
In finder I delete the folder, it goes to the trash.
Recreated folder in finder, with the same name, different content.
Do a ls in the terminal, which prints out the old directory's content.


Is this normal? Do I really have to cd .. on the terminal and enter the "new" directory? (If I cd .. I end up in Trash, not the directory's initial location)

I guess it is a soft link directory, but shouldn't the terminal know that the directory it is currently in doesn't exist anymore and cd .. until it reaches a existing directory? (At step 3)

Is there a reason why it should still point to the old directory?
You're in the "trash" directory now because when you threw out the folder, your view of that folder in the terminal went with it.  The terminal, being completely inside the directory, doesn't even need to know it's been moved to the trash.  It's pwd doesn't even change because it has no reason to re-validate the current directory path on every interaction - and why should it?  the directory itself is still valid, it just lives in ~/.Trash now.

Directories (or folders) are really just references to spots on a physical disk, so moving folders around your hard drive never changes their disk location, so again, why should the Terminal update?  It doesn't care.

It's a "gotcha" that's been part of linux for 20 years and unix for a great deal longer.