Skip to main content


From a POSIX shell `$OLDPWD` holds the name of the previous working directory:
cd /tmp
echo You are here: $PWD
echo You were here: $OLDPWD
cd $OLDPWD

#Unix #Linux #Shell #cd

in reply to Yes, I Know IT ! πŸŽ“

Neat :) Not being POSIX that doesn’t work for me in Fish shell but Alt+left-arrow goes to the previous working directory and Alt+right-arrow goes to the next.

#fishShell #cd #linux #unix

in reply to πŸ–‹ ~hyde

Ah, yes, I’d misremembered it as cd -1 yesterday while trying out the posix stuff in fish and was wondering why it wasn’t working :)
in reply to πŸ–‹ ~hyde

Ah, then that’s where I remember it from. I was on zsh before fish :)
⇧