DEV Community


superPyOS- the terminal

17lwinn profile image 17lwinn ・1 min read

It's been a while I know, but here is the second chapter!

the terminal was the main part of the OS, it had different commands controlling parts of the system. Something so powerful i'm going to say only involved the basic parts of python like user input, IF and the os module.

1. the modules

firstly you need to import your modules, we reccommend:

import os
import io
import platform    # modules to use
import subprocess
import sys
import glob
from time import *
import logging
from datetime import datetime

*logging will be explained later in the series.

2. the prompt

An OS prompt would be the location it is now, we can program this by using;

currentpath = os.getcwd() # get current path

so your prompt would be:

command = input(currentpath + "> ")

3. the commands!

Now that we have our input prompt, we can start adding commands!

each command would start as:

if command == "COMMAND":

then below that you add your function- what do you want it to do?

for example, perhaps we want to clear the screen? we would use the OS module for that.

if command == "clear":

of course- we need a way to loop the script- or after each command it'll quit.

so at the VERY END, we would put:


if you know how to use other modules, then you can link them up and start making your own beginner 'guest' operating systems!

Discussion (0)

Editor guide