Getting Started with Python on Ubuntu - Running from the Command Line Lab

Infosec Learning
Virtual Lab

Up to this point, you have run your Python scripts from inside Geany. Doing so is fine when a program is under development. Once development has been completed, there are many other options available to you, depending on your needs. In this lab, you will explore several different approaches, including the Python command, directly using the shebang,...

Time
1 hour 30 minutes
Difficulty
Beginner
Share
NEED TO TRAIN YOUR TEAM? LEARN MORE
Join over 3 million cybersecurity professionals advancing their career
Sign up with
or

Already have an account? Sign In »

Overview

Up to this point, you have run your Python scripts from inside Geany. Doing so is fine when a program is under development. Once development has been completed, there are many other options available to you, depending on your needs.

In this lab, you will explore several different approaches, including the Python command, directly using the shebang, absolute paths, and relative paths. You will also redirect standard input (stdin) and standard output (stdout) to and from your program and disk files, which really helps harness the power of CLI programs. As before, the focus will be on debugging and problem solving.

In Task 1, you will explore running your script from the command line using Python. You’ll also work with stdin, stdout, and the time module.

In Task 2, you’ll examine other ways of running your scripts