Back to the command reference

source

ShellFundamentals In simulator In real Linux

Run a script in the current shell (also written .)

Name: source: read and run (also spelled .)

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

source is a shell builtin that reads and runs a file's commands in the **current** shell instead of a child process, so its variables, functions, cd and exports affect your shell.

Use it to apply an edited ~/.bashrc immediately or to load setups such as a Python virtualenv. . is its POSIX name.

Syntax

source FILE [ARGS]

Examples

  • $ source ~/.bashrc

    Apply config changes right away

    Explain
  • $ . venv/bin/activate

    Activate a Python virtualenv

    Explain

Related