Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux: how to execute profile file [duplicate]

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?

like image 394
Yves Avatar asked Jan 06 '23 22:01

Yves


2 Answers

You can load the profile using source command:

source <profile-filename>

eg:

source ~/.bash_profile
like image 170
Nishu Tayal Avatar answered Jan 08 '23 12:01

Nishu Tayal


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.

like image 31
xapn Avatar answered Jan 08 '23 11:01

xapn