linux: how to execute profile file

15,981

Solution 1

You can load the profile using source command:

source <profile-filename>

eg:

source ~/.bash_profile

Solution 2

For your custom aliases, the best place should be at ~/.bash_aliases. You must just be sure the ~/.bashrc file already contains the following lines:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

or in a more concise manner:

[ -f ~/.bash_aliases ] && . ~/.bash_aliases

To load them immediately, source it. Otherwise, aliases will be loaded at every terminal opening. To check, use the alias command without argument.

Share:
15,981
Yves
Author by

Yves

BY DAT: hello world \n BY NIGHT: hello world \n FOR FUN: have fun \n

Updated on August 12, 2022

Comments

  • Yves
    Yves almost 2 years

    My colleague gave me a file containing lots of configs such as

    alias  ll="ls -l"
    alias  lr="ls -lrt"
    alias  gv="vim -g"
    

    How can I use(execute) this profile?