How do I create a Bash alias?

后端 未结 16 645
一个人的身影
一个人的身影 2020-11-28 17:38

I\'m on OSX and I need to put something like this, alias blah=\"/usr/bin/blah\" in a config file but I don\'t know where the config file is.

16条回答
  •  再見小時候
    2020-11-28 18:10

    I need to run the Postgres database and created an alias for the purpose. The work through is provided below:

    $ nano ~/.bash_profile 
    
    # in the bash_profile, insert the following texts:
    
    alias pgst="pg_ctl -D /usr/local/var/postgres start"
    alias pgsp="pg_ctl -D /usr/local/var/postgres stop"
    
    
    $ source ~/.bash_profile 
    
    ### This will start the Postgres server 
    $ pgst
    
    ### This will stop the Postgres server 
    $ pgsp
    

提交回复
热议问题