There can be various reasons why the .bashrc
file is not loaded at Ubuntu startup. Here are some possible causes and their solutions:
-
The
.bashrc
file does not exist or has been accidentally renamed: Check that the.bashrc
file exists in the user's home directory and that the file name is correct. If the file has been accidentally renamed, rename it back to.bashrc
. -
The
.bashrc
file does not have the correct permissions: Check that the.bashrc
file has the correct permissions to be executed. Use the commandls -l ~/.bashrc
to display the file's permissions and make sure that the current user has read and execute permissions on the file. -
The
.bashrc
file contains syntax errors: Check that the.bashrc
file does not contain syntax errors. You can use the commandbash -n ~/.bashrc
to check the file's syntax and detect any errors. -
The
.bashrc
file has not been loaded in the Bash configuration file: Check that the.bashrc
file has been added to the Bash configuration file (~/.bash_profile
or~/.bash_login
). If the Bash configuration file does not exist, create a new file and add the following line:bashsource ~/.bashrc
Alternatively, you can add this line to the
.profile
file in the user's home directory. -
The Bash configuration file has been modified: Check that the Bash configuration file (
~/.bash_profile
or~/.bash_login
) does not contain any other instructions that prevent the.bashrc
file from being loaded. For example, there might be a line in the configuration file that exits the script without loading the.bashrc
file.
In my case it was sufficient to delete .profile in the user's directory.