Oh-my-zsh has the take command which creates a directory and enters into it in one step. Is there an equivalent command for the fish shell?

I do know that I can do it with mkdir newDir && cd newDir, but I like the shorter, more convenient version that Oh-my-zsh provides.

1 Answer 1


Not built-in, but very easy to reproduce:

function take
    mkdir -p "$argv[1]"; and cd "$argv[1]"

funcsave take

This will create a lazy-load function in $HOME/.config/fish/functions/take.fish. By "lazy-load", we mean that the function isn't loaded when Fish starts, but only the first time you run the take command. So it's always available, but only takes up memory when you run it.

  • 1
    I'd recommend and cd in case mkdir fails. Commented Nov 21, 2021 at 22:31
  • @glennjackman Great point - Thanks! Edited. Could probably go one step further and still cd if the directory already exists. Not sure what the oh-my-zsh behavior is. Commented Nov 21, 2021 at 22:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .