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

So here is what I was doing:

  1. Created Directory with content and have it open in finder
  2. Open a terminal and go to the same directory.
  3. In finder I delete the folder, it goes to the trash.
  4. Recreated folder in finder, with the same name, different content.
  5. 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.

  • Doesn't that break a user's expectation? Partially. – PrivatMamtora Nov 5 '14 at 20:45
  • Unix and its shells are not about user's expectations :-) – nohillside Nov 5 '14 at 20:56
  • 1
    The user should change expectations. The Terminal is for the user interacting with the computer, not the computer interacting with the user. – mainstreetmark Nov 5 '14 at 21:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .