DEV Community

Arthur
Arthur

Posted on

How to Monitor Linux Server Performance Using Command-Line Tools

Hello, I'm Arthur.
A Linux server can appear healthy while quietly developing performance problems. CPU usage may increase, memory may become limited, or disk activity may slow down applications.

Without regular monitoring, these problems can go unnoticed until users start experiencing slow websites or failed requests.

The good news is that Linux includes several command-line tools that help administrators understand what is happening inside a server.

In this guide, we'll explore practical ways to monitor CPU, memory, disk, and network performance using built-in Linux commands.

1. Check the Overall System Status

Start by checking how long the server has been running and whether its workload has changed.

Run:

uptime
Enter fullscreen mode Exit fullscreen mode

This command displays the current time, system uptime, number of logged-in users, and load averages.

The load averages represent the average number of processes that are running or waiting for resources over the last 1, 5, and 15 minutes.

A rising load average can indicate increasing demand, but it does not automatically mean the CPU is overloaded.

Compare the load average with the number of CPU cores and other performance metrics before making changes.

2. Monitor CPU Usage

The CPU handles application instructions, background tasks, and other processing activities.

To monitor CPU usage in real time, run:

top
Enter fullscreen mode Exit fullscreen mode

This displays running processes and their resource consumption.

Look for processes that consistently consume a large percentage of CPU.

For a simpler snapshot of the most CPU-intensive processes, use:

ps aux --sort=-%cpu | head
Enter fullscreen mode Exit fullscreen mode

A web application may use more CPU during periods of high traffic. A database may also consume significant processing power when executing complex queries.

If CPU usage remains high, investigate the responsible process before upgrading the server.

Sometimes, optimizing an application or database query can improve performance without requiring additional resources.

3. Understand Memory Usage

Memory is important for applications, databases, and caching systems.

To check memory usage, run:

free -h
Enter fullscreen mode Exit fullscreen mode

The output includes total memory, used memory, available memory, and swap usage.

Pay attention to available memory rather than assuming that all used memory is a problem.

Linux uses available memory for caching, which can improve performance.

If available memory becomes consistently low, identify which processes are using the most RAM:

ps aux --sort=-%mem | head
Enter fullscreen mode Exit fullscreen mode

This can help identify applications that need more memory or require further investigation.

Also check whether the server is experiencing memory-related errors:

sudo journalctl -k --since "1 hour ago"
Enter fullscreen mode Exit fullscreen mode

Look for messages about out-of-memory events or processes being terminated by the kernel.

4. Monitor Disk Space and Activity

Disk problems can affect server performance even when CPU and memory usage appear normal.

Check available storage:

df -h
Enter fullscreen mode Exit fullscreen mode

This shows the capacity and usage of mounted filesystems.

If a filesystem is nearly full, investigate which directories are consuming space.

You can also inspect disk activity with iostat, if the tool is installed:

iostat -xz 1 5
Enter fullscreen mode Exit fullscreen mode

This reports disk statistics at one-second intervals for five reports.

Pay attention to disk utilization and latency.

Consistently high disk activity may indicate that an application is generating excessive disk operations or that storage performance needs investigation.

Do not assume that every disk performance issue requires faster storage. Application behavior and database configuration can also contribute to excessive disk activity.

5. Check Network Performance

Network delays can make a server appear slow even when its local resources are healthy.

To inspect network interface statistics, run:

ip -s link
Enter fullscreen mode Exit fullscreen mode

This displays information about transmitted and received packets, along with errors and dropped packets.

You can also check the response time of a website:

curl -o /dev/null -s -w \
"DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTotal: %{time_total}s\n" \
https://example.com
Enter fullscreen mode Exit fullscreen mode

This helps separate DNS resolution time, connection time, and total response time.

If the connection is fast but the overall response is slow, the problem may involve the application, database, or another service.

Network monitoring becomes especially useful when investigating intermittent performance problems.

6. Monitor Important Services

A server may have healthy system resources while an individual service is experiencing problems.

For example, a web server may be running but unable to process requests correctly.

Check the status of Nginx:

sudo systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

To inspect recent service logs:

sudo journalctl -u nginx -n 100
Enter fullscreen mode Exit fullscreen mode

Look for repeated errors, failed requests, or messages that occurred around the time performance changed.

If your application depends on a database or another backend service, check those services as well.

Monitoring individual services helps identify problems that system-wide metrics may not reveal.

7. Create a Simple Monitoring Routine

You do not need to check every metric continuously to maintain a useful monitoring process.

A simple routine can include:

  • Reviewing CPU and memory usage during peak traffic.
  • Checking disk space regularly.
  • Monitoring important services.
  • Reviewing logs when performance changes.
  • Recording normal performance levels for comparison.

For production environments, consider using a monitoring system that collects metrics over time and sends alerts when important thresholds are reached.

Historical data can help distinguish normal traffic spikes from unusual performance problems.

8. Choose Server Resources Based on Real Requirements

Monitoring becomes more useful when it helps you make better infrastructure decisions.

For general websites and applications, Seimaxim VPS hosting is an option to explore when evaluating server resources.

For workloads involving AI development, machine learning, or GPU-based computing, Seimaxim GPU dedicated servers provide another infrastructure option to consider.

The right configuration depends on your application's workload, expected traffic, and performance requirements.

Before upgrading, review your monitoring data to identify whether the actual limitation is CPU, memory, storage, or network performance.

Final Thoughts

Linux server monitoring helps administrators understand how applications use system resources and identify performance problems before they become major issues.

Start with basic commands such as uptime, top, free, and df.

Then investigate disk activity, network performance, and individual services when necessary.

Regular monitoring and a consistent troubleshooting routine can help you make better server management decisions and keep applications running reliably.

Top comments (1)

Collapse
 
sadaf_botanist profile image
smel •

Great guide! Regular Linux server monitoring is essential for identifying performance issues before they affect users. I especially like the practical use of commands like top, free -h, and iostat. Understanding resource usage helps administrators make better decisions about server optimization and infrastructure upgrades.