How to find out where alias (in the bash sense) is defined when running Terminal in Mac OS X

后端 未结 10 1131
时光取名叫无心
时光取名叫无心 2020-12-13 03:50

How can I find out where an alias is defined on my system? I am referring to the kind of alias that is used within a Terminal session launched from Mac OS X (10.6.3).

10条回答
  •  青春惊慌失措
    2020-12-13 04:08

    For OSX, this 2-step sequence worked well for me, in locating an alias I'd created long ago and couldn't locate in expected place (~/.zshrc).

    cweekly:~ $ which la
    la: aliased to ls -lAh
    
    cweekly:~$ grep -r ' ls -lAh' ~
    /Users/cweekly//.oh-my-zsh/lib/aliases.zsh:alias la='ls -lAh'
    

    Aha! "Hiding" in ~/.oh-my-zsh/lib/aliases.zsh. I had poked around a bit in .oh-my-zsh but had overlooked lib/aliases.zsh.

提交回复
热议问题