Suppose I am editing some files. I have (say) a terminal open and a gui file manager.
I am currently in /my/very/long/and/winding/directory/path
in the terminal.
In my gui, I delete
/my/very/long/and/winding/directory
Back in the terminal, I try cd ..
and I get an error, since the directory no longer exists.
No big deal. I could type cd /my/very/long/and/winding
to get back where I want to go. But if I'm too lazy to type that, is there a nice way to go back to the nearest directory that still exists?
edit: cd ../../
is one solution, in this particular case. But I'm wondering if there is a more general answer, where I don't know how many steps back I need to take.