/etc/profile, /etc/bashrc, ~/.bash_profile, ~/.bashrc are easy to confuse, what is the difference between them? What is their role?
/etc/profile: Used to set system environment parameters, such as $PATH. The environment variables inside are effective for all users in the system.
/etc/bashrc: This file sets the system bash shell-related things and is effective for all users in the system. As long as the user runs the bash command, then the things in it will work.
~/.bash_profile: Used to set some environment variables, the function is similar to /etc/profile, but this is set for users, that is, you set environment variables in /home/user1/.bash_profile, Then this environment variable only takes effect for the user user1.
~/.bashrc: The function is similar to /etc/bashrc, but it is only for the user himself and does not take effect for other users.
In addition, the variables (global) set in /etc/profile can act on any user, and the variables (local) set in ~/.bashrc etc. can only inherit the variables in /etc/profile, they are “father and child” Relationship.
~/.bash_profile is interactive and login mode to enter bash operation, which means that it will take effect only when the user logs in.
~/.bashrc is an interactive non-login way to enter bash to run, the user does not necessarily log in, as long as the command line is run as the user, the file will be read.
Here we can see that /etc/profile and ~./bashrc_profile are equivalent, and /etc/bashrc and ~/.bashrc are equivalent. The difference is that the scope of users is different. The former is for all users, and the latter is for all users. The person is for a single user. Here is one sentence: “/etc/bashrc: This file sets the system bash shell-related things and is effective for all users in the system. As long as the user runs the bash command, then the things inside are in effect.” We just prompted The problem is that the bash command cannot be found. Now we reconfigure the environment variables of the required command in /etc/bashrc, source /etc/bashrc to make the configuration effective, and execute the above program again to see the correct return of the corresponding command It turned out.
- Mac ADB prompts command not found
- Linux: How to configurate Environment Variables
- [Solved] Mac install maven Error: zsh: command not found: MVN
- Linux cron has no effect after executing the script, and the log reports an error orphan (no passwd entry)
- How to install “CONDA command not found” in MAC Anaconda
- Mac open terminal error – bash:: command not found
- When installing MySQL database on MAC, the system prompts MySQL: command not found
- [Solved] JPype Error: FileNotFoundError: [Errno 2] No such file or directory: ‘/usr/lib/jvm’
- [MacOS Catalina new Shell] How to Solve Error: The default interactive shell is now zsh
- macos -bash: yarn: command not found/-bash: cnpm: command not found