Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to jump to directories in fish using z-fish

📅 2013-Aug-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ fish ⬩ 📚 Archive

The biggest problem with using the shell is that it is painful to jump to different directories. If only the shell could remember the directories you most frequently use and allow you to jump to them by only typing only a few characters of its name? This is what z does! However, z is written for bash. Fish users need not despair since there is z-fish.

Install and use

  1. Clone the Github repository of z-fish. It has the z.fish shell file that is the z command.

  2. Add this line to your ~/.config/fish/config.fish

. /path/to/z-fish/z.fish
  1. cd around to all the directories you frequently use. This helps z-fish build its database. You can see this in the file ~/.z

  2. Now, to jump to any directory just provide a substring of its name to z. For example: z foo

Tried with: fish 2.7.1 and Ubuntu 18.04 LTS


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧