Skip to content

Commit aae1e3b

Browse files
committed
Update LinFo.py
1 parent 52173ea commit aae1e3b

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

LinFo.py

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env python3
2-
import os
2+
# Script: LinFo v 0.1
3+
# Author: kaotickj
4+
# Website: https://github.com/kaotickj
5+
36
import subprocess
47

58
####################
@@ -16,6 +19,7 @@
1619
DG = f"{C}[1;90m" # DarkGray
1720
NC = f"{C}[0m"
1821

22+
1923
def run_command(command):
2024
result = subprocess.run(
2125
command,
@@ -28,52 +32,67 @@ def run_command(command):
2832
else:
2933
return ""
3034

35+
3136
def get_os_info():
3237
os_info = run_command("lsb_release -sd 2>/dev/null")
3338
if not os_info:
3439
os_info = run_command("sw_vers -productName 2>/dev/null")
3540
return os_info
3641

42+
3743
def get_kernel_version():
3844
return run_command("uname -r")
3945

46+
4047
def get_host_name():
4148
return run_command("hostname")
4249

50+
4351
def get_uptime():
4452
return run_command("uptime -p")
4553

54+
4655
def get_package_count():
4756
return run_command("dpkg-query -f '${binary:Package}\n' -W 2>/dev/null | wc -l")
4857

58+
4959
def get_desktop_environment():
5060
return run_command("echo $XDG_CURRENT_DESKTOP | tr '[:upper:]' '[:lower:]'")
5161

62+
5263
def get_resolution():
5364
return run_command("xdpyinfo | awk '/dimensions:/ {print $2}'")
5465

66+
5567
def get_terminal():
5668
return run_command("echo $TERM")
5769

70+
5871
def get_shell():
5972
return run_command("basename $SHELL")
6073

74+
6175
def get_cpu_info():
6276
return run_command("lscpu | awk -F':' '/Model name/ {print $2}' | sed -e 's/^[ \\t]*//' 2>/dev/null")
6377

78+
6479
def get_gpu_info():
6580
return run_command("lspci | grep -i 'vga\\|3d' | awk -F': ' '{print $2}' 2>/dev/null")
6681

82+
6783
def get_memory_info():
6884
mem_total = run_command("grep MemTotal /proc/meminfo | awk '{print $2/1024/1024 \"GB\"}' 2>/dev/null")
6985
return f"{mem_total} (approximate)"
7086

87+
7188
def get_disk_usage():
7289
return run_command("df -h --total 2>/dev/null | awk '/total/ {print $2 \" used, \" $4 \" free\"}'")
7390

91+
7492
def get_interfaces():
7593
return run_command("ip -o link show | awk -F': ' '{print $2}' | grep -v 'lo'")
7694

95+
7796
os = get_os_info()
7897
kernel = get_kernel_version()
7998
host = get_host_name()
@@ -91,7 +110,7 @@ def get_interfaces():
91110

92111
print()
93112
print(f"\n\n{YELLOW} ⚙️ LinFo ⚙️")
94-
print(f"{LIGHT_MAGENTA} 🕵🔎 Powered by KaotickJ 👽 \n")
113+
print(f"{LIGHT_MAGENTA} 🕵🔎 Powered by KaotickJ 👽 \n")
95114
print(f"{GREEN} 🐧 OS:{LIGHT_CYAN} {os}")
96115
print(f"{GREEN} 🏠 Host:{LIGHT_CYAN} {host}")
97116
print(f"{GREEN} 🌽 Kernel:{LIGHT_CYAN} {kernel}")
@@ -124,4 +143,5 @@ def get_interfaces():
124143
print(" ░ ░ ▒ ░ ▒ ░░ ░░ ░ ▒░ ░ ░ ▒ ▒░")
125144
print(" ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒")
126145
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

Comments
 (0)