source command

LINUX-Frequently used commands

source command Reflecting a shell configuration file.
Syntax
source  [onfiguration file name]  
The source command is a command that executes the command written in a file in the current shell.
This is mainly used to reflect shell configuration files immediately without logging out or logging in..
Frequently used options
None.
Example: View file details.
$ su –  
Password:
#  source ~/.bashrc  ← Reflect the contents of the bash configuration file ~/.bashrc
The bash configuration file exists as a dot file in the user’s home directory

.bashrc bash Load settings on every start
.bash_profile Load settings on login
.bash_logout Load settings on logout
For example, a “bash file” will execute the file as a separate process from the current shell
If you simply execute a command line written in a file, such as the cat or ls command, the result will be the same.
However, the way shell and environment variables are handled will change

Shell variables are variables that are only valid in the currently running shell
Environment variables are variables that are inherited by the executed program (child process)
Both available in Shell
The export command can be used to convert shell variables into environment variables.

タイトルとURLをコピーしました