Directory history in the Fish shell

The Fish shell makes it very easy to jump around in your directory history. This is the list of directories that you had changed to using the cd command.

  • Fish supports jumping back to the previous directory, just like in Bash: cd -

  • To view the directory history: dirh You can see your current directory highlighted in color in this list.

  • To move to the next and previous directory in your history, use the nextd and prevd commands.

  • Typing these commands is too much? Not to worry, at an empty Fish prompt, you can cycle to your previous and next directories by just pressing the Alt + Left and Alt + Right keys.

  • Note: The Alt + Left and Alt + Right shortcuts might have been grabbed by your terminal program, like GNOME Terminal. They need to be freed for this to work. I use Terminator, where I disabled these keybindings by right-clicking in the terminal -> Preferences -> Keybindings.

Tried with: Fish 2.2b1, Terminator 0.97-2 and Ubuntu 14.04