Say good bye to cd and hello Zoxide - the better and smarter cd command! (2024)

Luxcih

Posted on

Say good bye to cd and hello Zoxide - the better and smarter cd command! (2) Say good bye to cd and hello Zoxide - the better and smarter cd command! (3) Say good bye to cd and hello Zoxide - the better and smarter cd command! (4) Say good bye to cd and hello Zoxide - the better and smarter cd command! (5) Say good bye to cd and hello Zoxide - the better and smarter cd command! (6)

#linux #cli #productivity #terminal

Introduction

If you're like me, you're constantly zipping around directories in your terminal, trying to keep up with your coding projects, side hustles, and random tech adventures. But let's be real for a second: the old cd command? It's feels like trying to navigate a maze blindfolded.

Zoxide

https://github.com/ajeetdsouza/zoxide

So, I stumbled upon this game-changing tool that's about to revolutionize the way you navigate your terminal: Zoxide. It works like magic in your terminal. It keeps track of the directories you frequently visit and ranks them based on your usage patterns. So, when you need to navigate to a directory, instead of wracking your brain trying to recall its exact path, you simply type z <directory_name> and voila! Zoxide intelligently takes you there in an instant.

Installation

https://github.com/ajeetdsouza/zoxide#installation

Install binary

Installing Zoxide is a breeze. You can grab it from your favorite package manager or build it from source - whatever floats your boat.

The recommended way to install zoxide is via the install script:

$ curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash

I use Arch BTW, so I'll install it using pacman:

$ sudo pacman -S zoxide

Setup zoxide

Once installed, just add a tiny snippet to the end of your shell configuration file (like .bashrc or .zshrc), and you're good to go!

For bash (~/.bashrc):

eval "$(zoxide init bash)"

For fish (~/.config/fish/config.fish):

zoxide init fish | source

For zsh (~/.zshrc):

eval "$(zoxide init zsh)"

Usage

https://github.com/ajeetdsouza/zoxide/wiki/Algorithm
You can find out more about Zoxide on its man page after installed:

$ man zoxide

To unlock its full potential, it's a good idea to train it. Training Zoxide involves simply using your terminal as you normally would for a bit, letting Zoxide observe your directory navigation patterns. Try navigating to your projects with Zoxide.

After training, using Zoxide is as easy as typing z <directory_name> to quickly navigate to frequently accessed directories without the full path!

Rebinding

Now, Zoxide is incredible, no doubt about it. But what if you're a creature of habit, like me, who's been typing cd for eons?

You can easily rebind the z command to cd, so you don't have to mess with your muscle memory:

For bash (~/.bashrc):

eval "$(zoxide init --cmd cd bash)"

For fish (~/.config/fish/config.fish):

zoxide init --cmd cd fish | source

For zsh (~/.zshrc):

eval "$(zoxide init --cmd cd zsh)"

Conclusion

In short, Zoxide is your terminal's new best friend, guiding you effortlessly through directories with just a few keystrokes. Say goodbye to aimless navigation and hello to smooth sailing with Zoxide!

PS: This is my first blog, so your feedback means the world to me!

Top comments (10)

Subscribe

Ben Sinclair

Ben Sinclair

I've been a professional C, Perl, PHP and Python developer.I'm an ex-sysadmin from the late 20th century.These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.

Apr 14

  • Copy link

I don't particularly like learning commands which enhance (or worse, shadow) existing commands, because I worry I'll lean on their behaviour in a script or on a foreign system and cause something bad to happen.

My issue with Zoxide is that I use a lot of directories with similar names in parallel hierarchies. Lots of similar projects.

When I have to type pwd after every directory change, or create an alias/function to do that for me, and devote extra braincells to pausing and checking before running the next potentially destructive command, I lose productivity.

I don't even like using CDPATH - and that's part of POSIX!

But if it works for you, great :)

Jan Küster

Jan Küster

Graduated in Digital Media M.Sc. now developing the next generation of educational software. Since a while I develop full stack in Javascript using Meteor. Love fitness and Muay Thai after work.

  • Location

    Bremen, Germany

  • Education

    M.Sc.

  • Pronouns

    he/him

  • Work

    Scientific Employee at University of Bremen

  • Joined

Apr 14

  • Copy link

I immediately think of adduser as extension to useradd

OneNemo

OneNemo

I am me, it would be nice if you would be you.

  • Location

    Cordele, GA USA

  • Joined

Apr 14 • Edited on Apr 14 • Edited

  • Copy link

Nice article. Straight forward without a lot of preamble or hyperbole. Though in the future you might want to give examples for installation on multiple distros such as Fedora and Ubuntu for people not so familiar with Gnu/Linux.

For instance to install on Fedora 39:

$ sudo dnf install zoxide

and of course add:

eval "$(zoxide init bash)"

to your .bash_profile or .bashrc file.

You could also mention that they can find out more about zoxide on its man page after installed.

$ man zoxide

I like the way you included information about other shells. Good job.

Looking forward to your future articles.

Take Care

Luxcih

Luxcih

Hey there, I'm Luxcih - a programming enthusiast and aspiring software engineer from the Philippines in the UTC+08:00 time zone.

  • Email

    luxcih.me@gmail.com

  • Location

    Philippines

  • Pronouns

    he/him

  • Joined

Apr 15 • Edited on Apr 15 • Edited

  • Copy link

Thank you so much, I'll take this into consideration.

Chris Dawkins

Chris Dawkins

My front-end is curl

  • Location

    Colorado

  • Work

    Software Developer

  • Joined

Apr 14

  • Copy link

If you're really adventurous you can try rpg-cli

Thomas Taylor

Thomas Taylor

AWS Community Builder @ Serverless & Senior Software Engineer

  • Email

    me@thomasgtaylor.com

  • Location

    North Carolina, USA

  • Education

    B.S. Computer Science

  • Pronouns

    He/Him

  • Work

    Software Engineer @ nCino

  • Joined

Apr 15

  • Copy link

Haha, thanks for this! I didn't know it existed.

Martin Brampton

Martin Brampton

Software developer and web host. Author of Remository extension for Joomla.

  • Joined

Apr 19

  • Copy link

Neat - thanks for posting. I'm trying it out - looks good.

Bart97coder

Bart97coder

Join the vibrant developer community at Dev.to! Discover insightful articles, engage in discussions, and share your own expertise on all things tech. Whether you're a seasoned pro or just starting you

  • Joined

Apr 15

  • Copy link

Intresting post

Christophe Colombier

Christophe Colombier

Smiling person, father of two, Husband, Senior Developer/Architect (in that exact order, it's important)Experience in development since 2004Linux user and advocate since 2001

  • Location

    Villeurbanne, France

  • Education

    Arts et Métiers

  • Work

    VP Technology

  • Joined

Apr 14

  • Copy link

Zoxide is a great tool. I'm using it for years, and I couldn't leave without it

Documendous

Documendous

Accomplished Full Stack Dev & Senior ECM Consultant with 20+ years of experience. Expertise in Django, Python, Java, JS, Docker, PostgreSQL, AWS

  • Location

    Colorado USA

  • Work

    Documendous

  • Joined

Apr 16

  • Copy link

zoxide f* rules.

For further actions, you may consider blocking this person and/or reporting abuse

Say good bye to cd and hello Zoxide - the better and smarter cd command! (2024)
Top Articles
Latest Posts
Article information

Author: Otha Schamberger

Last Updated:

Views: 5814

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Otha Schamberger

Birthday: 1999-08-15

Address: Suite 490 606 Hammes Ferry, Carterhaven, IL 62290

Phone: +8557035444877

Job: Forward IT Agent

Hobby: Fishing, Flying, Jewelry making, Digital arts, Sand art, Parkour, tabletop games

Introduction: My name is Otha Schamberger, I am a vast, good, healthy, cheerful, energetic, gorgeous, magnificent person who loves writing and wants to share my knowledge and understanding with you.