4.4. Running Programs in the Terminal¶
Quickly navigating through our filesystems is just one benefit of using the terminal for programmers. We can also quickly run our code inside of the terminal to see the outputs.
The commands used to run a program in the terminal vary widely based on type of program you want to run. However, no matter what language you are coding in, the documentation will include, in some format, ways to run the program in the terminal.
In Replit, we run our programs by hitting the “Run” button. If we type
python <file-name> into our terminal, we would be doing the same thing as the “Run” button!
Let’s say there is an error in our program like an infinite loop. How then do we get it to stop running so we can go back and fix our code?
In many cases, typing ctrl+c into the terminal will stop a process that is currently running. However, if that doesn’t work, the
exit command can also stop a currently running process.