A lightweight Bash script for quickly reviewing key Linux server performance metrics from the command line.
The script provides a concise system health snapshot including CPU, memory, disk usage, top resource-consuming processes, uptime, load average, logged-in users, and recent failed SSH login attempts when available.
- 🖥️ Operating system information
- 🧩 Kernel version
- ⏱️ System uptime
- 📈 Load average
- 👥 Logged-in user count
- ⚙️ CPU utilization
- 🧠 Memory utilization
- 💾 Disk utilization
- 🔥 Top 5 processes by CPU usage
- 🧮 Top 5 processes by memory usage
- 🔐 Recent failed login attempts
- 🕒 Report generation timestamp
- Bash
- Linux
awkgreppsdffreeuptimewhompstat
- Linux system
- Bash shell
sysstatpackage for thempstatcommand
sudo apt update
sudo apt install sysstatsudo yum install sysstatClone the repository:
git clone git@github.com:btambe-dev/server-performance-stats.git
cd server-performance-statsMake the script executable:
chmod +x server-performance-stats.shRun it:
./server-performance-stats.sh===========================================
SERVER PERFORMANCE STATISTICS
===========================================
OS Version: Ubuntu 24.04 LTS
Kernel Version: 6.x.x
Uptime: up 3 days
Load Average: 0.12, 0.18, 0.14
Logged in users: 1
-------------------------------------------
[CPU Usage]
User: 4.12% System: 1.25% Idle: 94.63%
-------------------------------------------
[Memory Usage]
Total: 16Gi | Used: 5.8Gi | Free: 3.1Gi | Usage: 36.25%
-------------------------------------------
[Disk Usage]
Total: 120G | Used: 46G | Free: 68G | Usage: 41%
-------------------------------------------
[Top 5 Processes by CPU Usage]
...
-------------------------------------------
[Top 5 Processes by Memory Usage]
...
-------------------------------------------
Report generated on: Sat Aug 8 22:00:00 EDT 2026
===========================================
Output varies by system and workload.
The script retrieves:
- Linux distribution name
- Kernel version
- Uptime
- Load average
- Number of logged-in users
CPU statistics are collected using mpstat.
The report displays:
- User CPU usage
- System CPU usage
- Idle CPU percentage
Memory statistics are collected with free -h and processed with awk.
The report displays:
- Total memory
- Used memory
- Free memory
- Usage percentage
The script uses df -h --total to summarize disk capacity.
The script lists the five processes consuming the most:
- CPU
- Memory
If /var/log/auth.log exists, the script displays the five most recent failed password attempts.
This section may require appropriate permissions depending on the Linux distribution and system configuration.
This project demonstrates hands-on experience with:
- Linux systems administration
- Bash scripting
- Server monitoring
- Command-line troubleshooting
- Process inspection
- Resource utilization analysis
- Log inspection
- Basic security monitoring
- Automation of routine administration tasks
Potential enhancements include:
- Command-line flags for selecting specific metrics
- Threshold-based warnings
- JSON or CSV output
- Logging reports to a file
- Email or webhook alerts
- Support for additional Linux distributions
- Network utilization metrics
- Docker container statistics
- Scheduled execution with cron
- Automated testing with ShellCheck
Bedolf Tambe
Cloud • DevOps • Networking • Systems Administration • Software Engineering