Directory Stacks In Bash Explained In One Post

linuxnavigationshell7 replies · 292 views · started
  1. ugh. i was jumping between a deep project folder and /var/log over and over, typing teh full paths each time. then I learned cd -. It takes you back to the previous directory, and running it again takes you back again. It toggles between two places.

    then i found pushd and popd. pushd /some/dir changes directory and remembers where you were on a stack. popd goes back. dirs -v shows teh stack. Works in bash and zsh, and PowerShell 6.2+ supports cd - too. any ideas??

    15
  2. are you on PowerShell 5.1 or 7?

    2 1 helpful
  3. powerShell 6.2 added cd - and cd + for back and forward through location history. windows PowerShell 5.1 doesnt have it. good luck man!

    1 0 helpful
  4. ok but which version are u on? :D make a backup before u touch the fan curve, learned that the hard way ?

    1 0 helpful
  5. ahh classic tools like zoxide or autojump learn your freuqent directories so u can jump with partial names. Great upgrade. good luck man!

    0 0 helpful
  6. ok so in scripts, prefer pushd/popd or subshells ( cd dir && command ) so u dont change the callers directory. good luck man!

    2 0 helpful

Reply to this topic

Sign in or create an account to reply.