How to write and save program from Terminal

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mirshany
    New Member
    • Oct 2012
    • 3

    How to write and save program from Terminal

    I am using ubuntu how I write my program from terminal to file and then how I open python file in terminal to run.
    Where should be file saved
    Last edited by bvdet; Oct 5 '12, 03:23 PM. Reason: Improve title
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    I can't help you with ubuntu, but in windows I use an interactive Python editor to create and run scripts. File management is something that is basic to your operating system and a matter of organization. I usually keep my "test" scripts in one subdirectory, finished scripts in another, and "packages" in unique subdirectories for each package. IDLE comes with Python. Have you tried it?

    Comment

    • mirshany
      New Member
      • Oct 2012
      • 3

      #3
      I am interested to Work with GEM5 so for that i am learning Python and the environment suits me is ubuntu

      Comment

      • eGrove Systems
        New Member
        • Dec 2012
        • 6

        #4
        step 1:
        1. open the terminal and type the below command.
        nano myfile.py

        2. Once you done this you have file opened in the name of myfile.py, then do all your programming stuff in the file.

        3. Then press (ctrl+o) in the keyboard then your file will be saved.

        4. Then press (ctrl+exit) , u will see the terminal again.

        5. Now run the below command where the file reside
        example: your file is in the Desktop
        1. type below command

        i.) cd /Desktop

        ii.) python myfile.py

        6. thats all you can see the output your program.

        Comment

        Working...