In the user directory, modify environment variables, are valid for the current user, and is permanent, modify the files .bash_profile, this file is in the current user directory.
If you want to after the changes, effective immediately, you can use the command source .bash_profile
Learning blog: https://www.cnblogs.com/franson-2016/p/6063226.html