Executing Shell Commands with Python

Introduction Repetitive tasks are ripe for automation. It is common for developers and system administrators to automate routine tasks like health checks and file backups with shell scripts. However, as those tasks become more complex, shell scripts may become harder to maintain. Fortunately, we can use Python instead of shell scripts for automation. Python provides methods to run shell commands, giving us the same functionality of those shells scripts. Learning how to run shell commands in Python opens the door […]

Read more

Python’s os and subprocess Popen Commands

Introduction Python offers several options to run external processes and interact with the operating system. However, the methods are different for Python 2 and 3. Python 2 has several methods in the os module, which are now deprecated and replaced by the subprocess module, which is the preferred option in Python 3. Throughout this article we’ll talk about the various os and subprocess methods, how to use them, how they’re different from each other, on what version of Python they […]

Read more