-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbin bash System Information.sh
More file actions
40 lines (31 loc) · 998 Bytes
/
bin bash System Information.sh
File metadata and controls
40 lines (31 loc) · 998 Bytes
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
#!/bin/bash
# System Information Script
# Displays key system metrics in a readable format
echo "================================"
echo " SYSTEM INFORMATION"
echo "================================"
echo ""
# Display hostname
echo "Hostname: $(hostname)"
# Display OS information
echo "OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d '"' -f 2)"
# Display kernel version
echo "Kernel: $(uname -r)"
# Display uptime
echo "Uptime: $(uptime -p)"
echo ""
echo "--- CPU Information ---"
# Display CPU model
echo "CPU: $(lscpu | grep 'Model name' | cut -d ':' -f 2 | xargs)"
# Display number of cores
echo "Cores: $(nproc)"
echo ""
echo "--- Memory Information ---"
# Display total and used memory
free -h | awk 'NR==2{printf "Total: %s | Used: %s | Free: %s\n", $2, $3, $4}'
echo ""
echo "--- Disk Usage ---"
# Display disk usage for all mounted filesystems
df -h | grep '^/dev/' | awk '{printf "%s: %s / %s (%s used)\n", $1, $3, $2, $5}'
echo ""
echo "================================"