DELAPARRA
Index
Color
NL
Category: CLI commands

source

Explained by Updated

What is source?

source: Source — Run a script in the current shell — useful for loading .env files or updating PATH. source runs a script inside your current shell, instead of in a new one. source ~/.bashrc reloads your shell settings, and source venv/bin/activate activates a Python virtual environment. A single dot, . script.sh, does the same.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about source

How is source used in practice?

The difference matters for variables. A script run normally starts a separate process, so any variables it sets disappear when it ends. A sourced script changes your current shell, so its variables and settings stay.

What should you keep in mind with source?

That is why loading environment variables from a file uses source, often combined with set -a so every variable is exported. Only source files you trust, because they run with your full permissions. For application settings, letting the framework read the .env file directly is usually cleaner than sourcing it into your shell.

At a glance

CategoryCLI commands
Explained by
Updated

More CLI commands terms

All terms starting with S

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.