Source (command)

From LQWiki
Jump to navigation Jump to search

The "source" command in Linux is used to execute commands from a file in the current user shell (terminal). For example, to run a script file in the current terminal.

As an example of this command, let's assume you have a script file called myscript.sh and it's saved in your user files in your sub-directory called "Projects." If you want to run that script file in your current terminal you would use the following command:

source /home/user/Project/myscript.sh<enter>

This will execute the commands written into the given file within the active terminal (or shell) window.