-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecsleuth.sh
79 lines (68 loc) · 2.19 KB
/
specsleuth.sh
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
#!/bin/bash
# Function to display system information
display_system_info() {
echo "System Information:"
echo "-------------------"
echo "Computer Name: $(hostname)"
echo "Manufacturer: $(sudo dmidecode -s system-manufacturer)"
echo "Model: $(sudo dmidecode -s system-product-name)"
echo "Serial Number: $(sudo dmidecode -s system-serial-number)"
echo "OS: $(lsb_release -d | cut -f 2)"
}
# Function to display CPU information
display_cpu_info() {
echo "CPU Information:"
echo "----------------"
echo "Processor: $(grep 'model name' /proc/cpuinfo | head -1 | cut -d ':' -f 2 | sed -e 's/^[ \t]*//')"
echo "Architecture: $(arch)"
echo "Cores: $(grep -c 'processor' /proc/cpuinfo)"
}
# Function to display memory (RAM) information
display_memory_info() {
echo "Memory Information:"
echo "-------------------"
echo "Total Memory: $(free -h | awk '/^Mem:/ {print $2}')"
echo "Used Memory: $(free -h | awk '/^Mem:/ {print $3}')"
}
# Function to display storage information
display_storage_info() {
echo "Storage Information:"
echo "--------------------"
df -h | grep '/dev/' | awk '{printf "%s (%s) - Free: %s\n", $1, $6, $4}'
}
# Function to display graphics card information
display_graphics_info() {
echo "Graphics Card Information:"
echo "--------------------------"
echo "GPU: $(lspci | grep VGA | cut -d ':' -f 3)"
echo "Driver: $(lspci -k | grep -A 2 'VGA' | grep 'Kernel driver' | cut -d ':' -f 2 | sed -e 's/^[ \t]*//')"
}
# Function to free up RAM by clearing cache and unnecessary processes
free_up_ram() {
echo "Freeing Up RAM:"
echo "---------------"
# Clear the disk cache
echo "Clearing Disk Cache..."
sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
echo "Disk Cache Cleared."
# Terminate unnecessary processes
echo "Terminating Unnecessary Processes..."
sudo sysctl vm.drop_caches=3 > /dev/null 2>&1
sudo sysctl vm.drop_caches=0 > /dev/null 2>&1
echo "Unnecessary Processes Terminated."
echo "RAM freed up successfully."
}
# Main function to call all display functions and free up RAM
main() {
display_system_info
echo
display_cpu_info
echo
display_memory_info
echo
display_storage_info
echo
display_graphics_info
echo
}
main