Session and utilities

The source command

Runs a command file in the current shell, so the variables and functions it defines stay in your session.

Syntax

source archivo | . archivo

Copy-ready examples

$ printf 'echo hola\n' > s.sh && source s.shRun a script

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Unlike running the script, source does not open a new process: the changes affect your session.

Related commands

FAQ

What is it used for?

To load environment variables or functions when the terminal starts.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course