Skip to content
Advertisement

What does it mean by using ‘source ‘ command in linux?

After creating virtual environment

virtualenv env

why do we need to fire source command ?

source env/bin/activate

What is the use of source command in general in linux ?

Advertisement

Answer

source : it will read file and execute cmd in file, in current shell environment.

usually it’s used to add some environment vars.

for example.

> echo $MY_ENV
// nothing 

> cat foo.txt
export MY_ENV=bar
> source foo.txt
// after source, MY_ENV is set in current env

> echo $MY_ENV
bar
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement