Shell and Environment

source

Runs a script in the current shell.

source reads shell commands from a file without starting a separate child shell, so variable and function changes stay in the current shell.

Syntax
source file

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Reload Bash config
source ~/.bashrc

Applies changes from ~/.bashrc to the current shell.

Load environment file
source .env

Runs assignments from .env in the current shell. Only do this with trusted files.

source Command
FieldDetails
Commandsource
CategoryShell and Environment
Primary useRuns a script in the current shell.
Syntaxsource file