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

One thought on “Directory history in the Fish shell

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.