In Ubuntu, there are the following files to set environment variables:
/etc/profile: When logging in, the first file used by the operating system to customize the user environment. This file sets environment information for each user of the system. When the user logs in for the first time, this file is executed.
/etc/environment: The second file used by the operating system when logging in. The system sets the environment variables of the environment file before reading your own profile.
~/.profile: The third file used when logging in is the .profile file. Each user can use this file to enter shell information dedicated to their own use. When the user logs in, the file is only executed once! By default Next, he sets some environment variables and executes the user's .bashrc file.
/etc/bashrc: Execute this file for each user running the bash shell. This file is read when the bash shell is opened.
~/.bashrc: This file contains bash information specific to your bash shell. This file is read when logging in and every time a new shell is opened.