source
Linux · Terminal · reference only
What it does
Runs a script inside the current shell, so the variables, aliases and functions it defines stay available in your session.
Syntax
source fichero [argumentos...] . fichero [argumentos...]
Options and parameters
ficheroScript that is run in the current shell.
argumentosPositional parameters the script receives as $1, $2...
. (punto)Short equivalent form of source, valid in any POSIX shell.
--Can be written before the name if the file starts with a dash.
Usage examples
source ~/.bashrcReloads your bash configuration without closing the terminal.
source entorno.shLoads into the current session the variables defined in a script.
source venv/bin/activateActivates a Python virtual environment.
. ./variables.envUses the short form to load a variables file.
Notes and common mistakes
- If you run the script as ./script.sh a child shell is started and its variables disappear when it ends; with source they persist.
- An exit inside the script would close your current session.