Basics of running Python scripts from bash shell

Download a nice free open software called ATOM, create a file called

from __future__ import absolute_import, division, print_function

print (‘hello’)

Navigate to the directory that you just created and try to python script:

[delanajero@DELAN Documents]$ python


If you want to run just the script without typing python before the file perform the following:

[delanajero@DELAN Documents]$ chmod +x

  • make sure that the file is executable by adding execute to the file than just read and write.

to verify:

[delanajero@DELAN Documents]$ ls -l

total 4

-rwxrwxr-x. 1 delanajero delanajero 82 Jul 22 21:40

Include the following command so python would know where to locate the command as a python script:

[delanajero@DELAN Documents]$ PATH=”$(pwd):$PATH”

Add the following to your python script:

#!/usr/bin/env python


[delanajero@DELAN Documents]$


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s