alias on zsh

When I open a terminal and type alias I see a list of commands. for example


kr=kubectl


I do not see this defined in /Users/xxx/.zshrc file and when i overwrite it in .zshrc file with below command, this does not work in terminal.


alias kr=kubectl -n runner


I want kr to alias with kubectl -n runner but it's currently set to kubectl not sure where is it being set. I want to delete kr=kubectl and set kr=kubectl -n runner.


Help please.

MacBook Pro 13″, macOS 12.4

Posted on May 31, 2022 9:00 PM

Reply
4 replies

Jun 1, 2022 4:45 AM in response to hsjagadeesh

What BobHarris says about quoting aliases. Going a little further, Zsh aliases can take command arguments too. Note that your PATH in the ~/.zshrc file should be set to accommodate executable access, or you will need to explicitly show the path to the executable:


alias brew_deps='brew deps --tree --installed "$@"'


Usage:



Zsh aliases are discussed here, and from the command line in the Terminal:


man zshbuiltins


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

alias on zsh

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.