1
1
#!/usr/bin/env python3
2
- import os
2
+ # Script: LinFo v 0.1
3
+ # Author: kaotickj
4
+ # Website: https://github.com/kaotickj
5
+
3
6
import subprocess
4
7
5
8
####################
16
19
DG = f"{ C } [1;90m" # DarkGray
17
20
NC = f"{ C } [0m"
18
21
22
+
19
23
def run_command (command ):
20
24
result = subprocess .run (
21
25
command ,
@@ -28,52 +32,67 @@ def run_command(command):
28
32
else :
29
33
return ""
30
34
35
+
31
36
def get_os_info ():
32
37
os_info = run_command ("lsb_release -sd 2>/dev/null" )
33
38
if not os_info :
34
39
os_info = run_command ("sw_vers -productName 2>/dev/null" )
35
40
return os_info
36
41
42
+
37
43
def get_kernel_version ():
38
44
return run_command ("uname -r" )
39
45
46
+
40
47
def get_host_name ():
41
48
return run_command ("hostname" )
42
49
50
+
43
51
def get_uptime ():
44
52
return run_command ("uptime -p" )
45
53
54
+
46
55
def get_package_count ():
47
56
return run_command ("dpkg-query -f '${binary:Package}\n ' -W 2>/dev/null | wc -l" )
48
57
58
+
49
59
def get_desktop_environment ():
50
60
return run_command ("echo $XDG_CURRENT_DESKTOP | tr '[:upper:]' '[:lower:]'" )
51
61
62
+
52
63
def get_resolution ():
53
64
return run_command ("xdpyinfo | awk '/dimensions:/ {print $2}'" )
54
65
66
+
55
67
def get_terminal ():
56
68
return run_command ("echo $TERM" )
57
69
70
+
58
71
def get_shell ():
59
72
return run_command ("basename $SHELL" )
60
73
74
+
61
75
def get_cpu_info ():
62
76
return run_command ("lscpu | awk -F':' '/Model name/ {print $2}' | sed -e 's/^[ \\ t]*//' 2>/dev/null" )
63
77
78
+
64
79
def get_gpu_info ():
65
80
return run_command ("lspci | grep -i 'vga\\ |3d' | awk -F': ' '{print $2}' 2>/dev/null" )
66
81
82
+
67
83
def get_memory_info ():
68
84
mem_total = run_command ("grep MemTotal /proc/meminfo | awk '{print $2/1024/1024 \" GB\" }' 2>/dev/null" )
69
85
return f"{ mem_total } (approximate)"
70
86
87
+
71
88
def get_disk_usage ():
72
89
return run_command ("df -h --total 2>/dev/null | awk '/total/ {print $2 \" used, \" $4 \" free\" }'" )
73
90
91
+
74
92
def get_interfaces ():
75
93
return run_command ("ip -o link show | awk -F': ' '{print $2}' | grep -v 'lo'" )
76
94
95
+
77
96
os = get_os_info ()
78
97
kernel = get_kernel_version ()
79
98
host = get_host_name ()
@@ -91,7 +110,7 @@ def get_interfaces():
91
110
92
111
print ()
93
112
print (f"\n \n { YELLOW } ⚙️ LinFo ⚙️" )
94
- print (f"{ LIGHT_MAGENTA } 🕵🔎 Powered by KaotickJ 👽 \n " )
113
+ print (f"{ LIGHT_MAGENTA } 🕵🔎 Powered by KaotickJ 👽 \n " )
95
114
print (f"{ GREEN } 🐧 OS:{ LIGHT_CYAN } { os } " )
96
115
print (f"{ GREEN } 🏠 Host:{ LIGHT_CYAN } { host } " )
97
116
print (f"{ GREEN } 🌽 Kernel:{ LIGHT_CYAN } { kernel } " )
@@ -124,4 +143,5 @@ def get_interfaces():
124
143
print (" ░ ░ ▒ ░ ▒ ░░ ░░ ░ ▒░ ░ ░ ▒ ▒░" )
125
144
print (" ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒" )
126
145
print (" ░ ░ ░ ░ ░ ░" )
127
- print (f" 🎈🎈🎈 { LIGHT_CYAN } y{ YELLOW } O{ BLUE } u{ LIGHT_MAGENTA } 'L{ RED } l{ YELLOW } f{ LIGHT_CYAN } L{ RED } o{ LIGHT_CYAN } A{ YELLOW } t{ GREEN } { BLUE } t{ LIGHT_MAGENTA } O{ GREEN } o! 🎈🎈🎈 { NC } " )
146
+ print (
147
+ f" 🎈🎈🎈 { LIGHT_CYAN } y{ YELLOW } O{ BLUE } u{ LIGHT_MAGENTA } 'L{ RED } l{ YELLOW } f{ LIGHT_CYAN } L{ RED } o{ LIGHT_CYAN } A{ YELLOW } t{ GREEN } { BLUE } t{ LIGHT_MAGENTA } O{ GREEN } o! 🎈🎈🎈 { NC } " )
0 commit comments