I want to know which file to edit in order to launch my .bash_profile
when I graphically start the terminal.
I am using an AWS Workspace with the following OS and the default MATE terminal.
$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
There are so many files in ~/etc
:
bashrc
profile
/profile.d
#lots of .sh
But in my /home/<usr>
directory I have:
.bashrc
.bash_profile
^ I created this bash_profile file and it works when I launch the terminal graphically and do $ source ~/.bash_profile
REQUESTED EDIT:
This is what I am putting in my .bash_profile
it colors my command prompt on every line and adds a timestamp and mentions the virtualenv I have active. I expect it to
# in order to be able to change the color of venv prompt
#
function virtualenv_info(){
# Get Virtual Env
if [[ -n "$VIRTUAL_ENV" ]]; then
# Strip out the path and just leave the env name
venv="${VIRTUAL_ENV##*/}"
else
# In case you don't have one activated
venv=''
fi
[[ -n "$venv" ]] && echo "(pvenv:$venv) "
}
# disable the default virtualenv prompt change
export VIRTUAL_ENV_DISABLE_PROMPT=1
VENV="\$(virtualenv_info)";
#
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/<b:\1>/'
}
# set the prompt color
# color starts with `\e[36m` and is closed with `\e[0m`
export PS1="\e[36m[\t] \e[38;5;203m${VENV}\e[38;5;78m\$(git_branch) \e[38;5;179m\w \e[0m☯ "
WORKAROUND by checking this box in the default MATE terminal application.
--login
option which causes Bash to read your~/.bash_profile
,~/.bash_login
, and~/.profile
files (in that order).~/.bash_profile
and when you need them to be sourced. The simple answer is that you probably want to be using~/.bashrc
instead of~/.bash_profile
, but the details will depend on exactly what you are doing./etc/profile
and then it will only read the first of those files. So if~/.bash_profile
exists,~/.bash_login
and~/.profile
will be ignored. From the INVOCATION section ofman bash
: "After reading [/etc/profile], it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable."