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?
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?
 
    
    You can load the profile using source command:
source <profile-filename>
eg:
source ~/.bash_profile
 
    
    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.
 
    
    You can put it in your local .bashrc (or appropriate shell rc file) file if you want it permanently.
cat fileNameProfile >> ~/.bashrc
And for current session:
source ~/.bashrc
If you want it just now, then:
source fileNameProfile
 
    
    For one time use, copy paste commands to your terminal:-
alias  ll="ls -l"
alias  lr="ls -lrt"
alias  gv="vim -g"
For everytime use, add it in .bashrc.
echo 'alias  ll="ls -l"' >>  ~/.bashrc
echo 'alias  lr="ls -lrt"' >> ~/.bashrc
echo 'alias  gv="vim -g"' >> ~/.bashrc
and then source ~/.bashrc
 
    
    To autoload these alias commands, create a .sample_profile file and add the alias on the file. after that add this text in .bashrc file
.bashrc
if [ -f ~/.sample_profile ]; then
    . ~/.sample_profile
fi
