How to make a permanent zsh alias in command-line?

我们两清 提交于 2021-02-20 04:09:05

问题


I want to permanently store zsh aliases. When I make an alias and shut down ITerm and reopen and it's gone!

alias mkcd="function _mkcd(){mkdir "$1"; cd "$1"} _mkcd"
mkcd Ken
zsh: command not found: mkcd

How can I make it permanent?


回答1:


Create a file .zshrc in your home directory if it does not exist already and add the alias to the file.

Next time when you open the terminal. It will be available.

To use it in the same session, just source the .zshrc file by running the command . .zshrc from your home directory.



来源:https://stackoverflow.com/questions/56044309/how-to-make-a-permanent-zsh-alias-in-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!