source

Run the commands from a file in the current shell

What it does

source reads a file and runs its commands in the current terminal. Its main use is picking up changed settings without a restart: after editing ~/.bashrc (~/.zshrc in zsh), source ~/.bashrc is enough.

Unlike running a script as a separate program, the variables and functions from the file stay in your session. That is also how a Python virtual environment is activated: source venv/bin/activate. The short form is a dot: . ~/.bashrc.

Syntax

source <file>
. <file>

Examples

Related commands

Practise · All commands