The .profile
dates back to the original Bourne shell known as sh
. Since the GNU shell bash
is (depending on its options) a superset of the Bourne shell, both shells can use the same startup file. That is, provided that only sh
commands are put in .profile
For example, alias
is a valid built-in command of bash
but unknown to sh
. Therefore, if you had only a .profile
in your home directory and put an alias
statement in it, sh
would complain. So there is a bash specific file that has shell initialization commands which bash will read if and only if there isn't a .profile
file present.
Actually that's a bit of an oversimplification in some installations, and I'm not familiar with Fedora. Under bash, /etc/profile
is read by the shell before any files in your home directory. If there is a system wide initialization script it often says something like
if there is a $HOME/.profile:
source it
elseif bash is my shell and there is a $HOME/.bash_profile:
source that
Why is that way? An attempt at compatibility across decades of shell dialects. Why is the tutorial written that way? The Bourne shell is not often used much any more and some people don't even know that there is any other Bourne-like shell than bash. Even when the (limited) Bourne syntax is used for greater cross-platform compatibility it is often being run by dash
or bash in POSIX compatibility mode. Indeed, the actual Bourne shell source is probably a copyright component of Unix System V which appears to be the property of Novell now but I have no idea what, if anything, they are doing with it.
For the beginning user, use either $HOME/.profile
or $HOME/.bash_profile
but not both and you'll be fine. Since you already have a .bash_profile
work with that because it may have system specific stuff in it that your installation needs.