A simple Bash script to analyze basic server performance statistics on any Linux system. a project from the road map projects: https://roadmap.sh/projects/server-stats
The server-stats.sh script provides the following information:
- β CPU Usage β Total CPU usage percentage.
- β Memory Usage β Used vs free memory (including percentage).
- β Disk Usage β Used vs free disk space (including percentage).
- β Top Processes by CPU β Top 5 processes consuming the most CPU.
- β Top Processes by Memory β Top 5 processes consuming the most memory.
These are included for deeper insight into your system (optional but useful):
- π₯οΈ OS version
- β±οΈ System uptime
- βοΈ Load average
- π€ Logged-in users
- β Failed login attempts
- A Linux system (Ubuntu, CentOS, Debian, etc.)
- Bash shell
1.Clone the repository:
git clone https://github.com/MosabAwadAhmedAlhadi/ServerPerformanceStats.git
cd ServerPerformanceStats2.Make the script executable:
chmod +x server-stats.sh3.Run the script:
./server-stats.shπ ## Sample Output
==== Server Performance Stats ====
---- CPU Usage ----
CPU Usage: 4.2%
---- Memory Usage ----
Used Memory: 2651648
Free Memory: 5282296
Usage Percentage: (33.42%)
---- Disk Usage ----
Used disk space: 64G
Free disk space: 68G
Total disk space: 138G
Usage Percentage: 49%
---- Top 5 Processes by CPU Usage ----
PID COMMAND %CPU
7362 ps 300
3798 firefox 5.1
5134 Isolated Web Co 4.2
2961 gnome-shell 3.4
4077 Isolated Web Co 1.1
---- Top 5 Processes by Memory Usage ----
PID COMMAND %MEM
3798 firefox 6.5
4077 Isolated Web Co 5.7
5134 Isolated Web Co 5.4
2961 gnome-shell 3.9
4860 Isolated Web Co 2.4
---- OS Version ----
Ubuntu 24.04.1 LTS
---- Uptime ----
up 1 hour, 39 minutes
---- Load Avarage ----
0.66, 0.40, 0.33
---- Logged-In Users ----
username
---- Failed Login Attempts ----
Number of failed login attempts: 0