Server Performance Stats Script
A simple Bash script to analyze and display basic server performance statistics on any Linux machine. This project helps you understand how to monitor system health using standard Linux commands.
π Project Overview
The goal of this project is to build a shell script (server-stats.sh) that provides a quick overview of a serverβs current performance. It is useful for basic debugging, learning Linux system monitoring, and understanding resource utilization.
π Features
The script displays the following system statistics:
β Core Requirements
Total CPU usage
Total Memory usage
Used vs Free memory
Percentage usage
Total Disk usage
Used vs Free disk space
Percentage usage
Top 5 processes by CPU usage
Top 5 processes by Memory usage
β Optional / Stretch Features
Operating System version
System uptime
Load average
Logged-in users
Failed login attempts (if available)
π οΈ Technologies Used
Bash / Shell Scripting
Standard Linux utilities:
top
free
df
ps
awk
grep
uptime
uname
No external dependencies are required.
π Project Structure . βββ server-stats.sh βββ README.md
βοΈ How to Run the Script
Clone the repository:
git clone https://github.com/your-username/server-performance-stats.git cd server-performance-stats
Give execute permission:
chmod +x server-stats.sh
Run the script:
./server-stats.sh
π Sample Output ===== Server Performance Stats =====
CPU Usage: 23%
Memory Usage: Used: 3.2 GB / 8 GB (40%) Free: 4.8 GB
Disk Usage: /dev/sda1 - Used: 45% | Free: 55%
Top 5 Processes by CPU Usage: PID COMMAND CPU% 1234 node 18.2 ...
Top 5 Processes by Memory Usage: PID COMMAND MEM% 5678 chrome 12.4 ...
π― Learning Outcomes
By completing this project, you will learn:
How to inspect system performance using Linux CLI tools
How to parse command output using awk and grep
How to write readable and maintainable shell scripts
Basics of server monitoring and troubleshooting
π§© Future Improvements
Add colored output for better readability
Export stats to a log file
Add alert thresholds (CPU/memory > X%)
Support for macOS (limited)
π€ Contributing
Contributions are welcome. Feel free to fork the repository, create a feature branch, and submit a pull request.
π License
This project is open-source and available under the MIT License.
π€ Author
Ankit Singh Yadav Backend Developer | Node.js | System Design Feel free to connect and provide feedback.