Menu driven Python program to execute Linux commands
Linux is one of the most popular operating systems and is a common choice for developers. However, it is difficult to remember the vast range of commands that Linux supports, and hence a Python program that can run these commands easily is demonstrated below.
In this article, we will deal with a Python program that can be used to run complex Linux commands. This program is a drop-down menu that gives the user a choice list and the user can proceed with his/her required option. Python has an OS module that can be used to run or execute Linux commands. The os module helps interact with the Operating System.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Here are the functionalities implemented in this program:
- Displaying the current date.
- Displaying the calendar.
- Configuring the web.
- Configuring docker.
- Adding a user.
- Deleting a user.
- Creating a file.
- Creating a folder.
Running the application
The application must be run on a Linux terminal.
Steps to run the application:
- Open the root account from the computer. If one does not have access to the root account then some of the root privileged commands may not work properly.
- Open the Linux terminal
- Go to the location where the .py file is saved using the cd command
- Run the .py file using python3 tui.py command