This applies only to Linux/Unix systems but Windows users might be curious as well about the first line of the program. First, give the program executable permission using the chmod command and then run the source program.
$ chmod a+x hello.py $ ./hello.py Hello World
The chmod command is used here to change the mode of the file by giving execute permission to all users. Then, we execute the program directly. We use the ./ to indicate that the program is located in the current directory.
To make things more fun, you can rename the file to just hello and run it as ./hello and it will still work since the system knows that it has to run the program using the interpreter located at the filename specified in the first line.
You are now able to run the program as long as you know the path of the program, but what if you wanted to be able to run the program from anywhere? You can do this by putting the program in one of the directories listed in the PATH environment variable. Whenever you run a program, the system looks for that command in each of the directories listed in the PATH environment variable.
$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/swaroop/bin $ cp hello /home/swaroop/bin $ hello Hello World!
What we are doing here, is that we first see what the PATH environment variable contains using the echo command as shown above. Note that we retrieve the value of variables in the shell by prefixing $ to the name of the variable. We see that /home/swaroop/bin is one of the directories in the PATH variable (where swaroop is the username I am using in my system). There might be a similar directory for your username in your system. Next, we copy the file to this directory. Now, we simply run hello and we get those famous words. Note that now you can run your program from anywhere i.e. irrespective of your current directory.
This method will be very useful when you want to write certain scripts and you want to be able to run those programs anytime anywhere. It is like creating your own commands just like cd or any other commands you use in the Linux terminal or DOS prompt.
With respect to Python, a program or script or software all mean the same thing.