-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbasic.py
More file actions
85 lines (71 loc) · 2.59 KB
/
basic.py
File metadata and controls
85 lines (71 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import os
import time
def main():
f=1
os.system("clear")
while(f==1):
print(" \n ==============================================================================================")
print("\t\tBasic Linux Commands Automation")
print("\n ==============================================================================================\n")
print("\n\t\tSelect Any Linux Command --> \n")
print("\t\t1: Run DATE command")
print("\t\t2: Run CAL command")
print("\t\t3: Run LS command")
print("\t\t4: Show IP Address of system")
print("\t\t5: Show Running Processes")
print("\t\t6: Show present working Directory")
print("\t\t7: Create Folder in Current Directory")
print("\t\t8: Read File from Current Directory")
print("\t\t9: Exit")
print("\n ==============================================================================================\n")
op =int(input("\tEnter Your Choice:: "))
print("\n")
if op==1:
#For DATE command
print("\n\t<<< Running DATE Command >>>\n")
os.system("date")
elif op==2:
#For CAL command
print("\n\t<<< Running CAL Command >>>\n")
os.system("cal")
elif op==3:
#For LS command
print("\n\t<<< Running LS Command >>>\n")
os.system("ls")
elif op==4:
#For ifconfig command
print("\n\t<<< Running ifconfig Command >>>\n")
os.system("ifconfig enp0s3")
elif op==5:
#For PS command
print("\n\t<<< Running PS Command >>>\n")
os.system("ps")
elif op==6:
#For PWD command
print("\n\t<<< Running PWD Command >>>\n")
os.system("pwd")
elif op==7:
#For mkdir command
d=input("Enter Name Of Folder You Want to Create: ")
print("\n\tCreating Folder...\n")
os.system("mkdir {}".format(d))
time.sleep(1)
print("\n\t<<< Folder Created >>>\n")
elif op==8:
#For cat command
print("\n\t<<< List of Files >>>\n")
os.system("ls")
print("\n")
d=input("Enter Name Of File You Want to Read: ")
print("\n\t Readiing File...\n")
os.system("cat {}".format(d))
elif op==9:
#Back to main menu
print("\n\t Directing Back To Main Menu...\n")
time.sleep(1)
f=0
else:
print("Not an option!!!")
f=0
if __name__=='__main__':
main()