Note to my future self: A little bash trick (works in zsh too)
I'm listing the contents of a directory:

$ ls /path/dir/subdir/distdir

And want to navigate into it. Instead of retyping the whole path:

$ cd /path/dir/subdir/distdir

just use the quick substitution shortcut:

$ ^ls^cd

This replaces ls with cd in the previous command.

Source: GNU Bash Manual https://www.gnu.org/software/bash/manual/html_node/Event-Designators.html

^string1^string2^

Quick Substitution. Repeat the last command, replacing string1
with string2. Equivalent to !!:s^string1^string2^.

Source: Bash Cookbook - Quick Substitution: https://www.oreilly.com/library/view/bash-cookbook/0596526784/ch18s04.html

#bash #shell #notetoself

Event Designators (Bash Reference Manual)

Event Designators (Bash Reference Manual)

@sterpeto that *is* useful! You can also make use of the CDPATH variable, if it's a directory that you visit often..
@apgarcia That's something I need to use.