Skip to content

Latest commit

 

History

History
150 lines (84 loc) · 2.47 KB

File metadata and controls

150 lines (84 loc) · 2.47 KB

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.