Skip to content
Advertisement

Is there a quick method on linux to switch to recently accessed n folders (n > 1)?

We can use cd - to access the most recently accessed folder, but what if I want to quickly switch to the last but one folder accessed?

Advertisement

Answer

Sure there’s a way! You want the shell builtin pushd.

[~]$ pwd
/home/dan
[~]$ pushd /tmp
/tmp ~
[tmp]$ pushd /usr/bin
/usr/bin /tmp ~
[bin]$ pushd +2
~ /usr/bin /tmp
[~]$
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement