VOOZH about

URL: https://www.geeksforgeeks.org/python/menu-driven-python-program-to-execute-linux-commands/

⇱ Menu driven Python program to execute Linux commands - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Menu driven Python program to execute Linux commands

Last Updated : 15 Jul, 2025

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.

Here are the functionalities implemented in this program:

  1. Displaying the current date.
  2. Displaying the calendar.
  3. Configuring the web.
  4. Configuring docker.
  5. Adding a user.
  6. Deleting a user.
  7. Creating a file.
  8. Creating a folder.
     

Running the application 
The application must be run on a Linux terminal. 
Steps to run the application: 

  1. 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.
  2. Open the Linux terminal
  3. Go to the location where the .py file is saved using the cd command
  4. Run the .py file using python3 tui.py command


Output 
 

Comment