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

后端 未结 10 1111
时光取名叫无心
时光取名叫无心 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:12

    First use the following commands

    List all functions

    functions 
    

    List all aliases

    alias 
    

    If you aren't finding the alias or function consider a more aggressive searching method

    Bash version

    bash -ixlc : 2>&1 | grep thingToSearchHere
    

    Zsh version

    zsh -ixc : 2>&1 | grep thingToSearchHere
    

    Brief Explanation of Options

    -i     Force shell to be interactive.
    
    -c     Take the first argument as a command to execute
    
    -x      -- equivalent to --xtrace
    
    -l      Make bash act as if invoked as a login shell
    

提交回复
热议问题