DEV Community

Discussion on: Bash: How To Teleport In The Terminal

Collapse
 
cmbell715 profile image
Colin

~- is the value of the shell variable OLDPWD, so you can list out your previous directory with ls ~- . Saves a little time from having to type all the extra characters in cd - && ls && cd - .

But since it holds the actual directory path, it's even more useful because you can quickly list out any subdirs with ls ~-/oldPwdSubDir/anotherSubdir