Ubuntu 19.04 .bash_profile doesn't exists

I'm trying to setup the WP-CLI completion from their sitebut I couldn't find the ~/.bash_profile file in my home directory and I tried the instructions with the ~/.bashrc file, I followed the zsh instructions too but it didn't work. Is it normal that there is no .bash_profile? Is it good if I create it manually?Terminal Files

1 Answer

Is it normal that there is no .bash_profile?

Yes it is - the default files copied from /etc/skel during account creation by adduser are:

$ ls -A /etc/skel
.bash_logout .bashrc .config .kshrc .mkshrc .profile Templates

As you can see, there is a default .bash_logout but no default .bash_profile.

Is it good if I create it manually?

Yes that's fine - be aware that if you do so, it will be read in preference to the ~/.profile file - from the INVOCATION section of man bash:

 When bash is invoked as an interactive login shell, or as a non-inter‐ active shell with the --login option, it first reads and executes com‐ mands from the file /etc/profile, if that file exists. After reading that file, 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. The --noprofile option may be used when the shell is started to inhibit this behavior.

so you may wish to source ~/.profile from the new ~/.bash_profile in order to maintain any functionality that it provides.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like