A Linux VPS is a flexible and powerful solution for hosting websites, applications, and projects of any scale. However, even the most expensive VPS won’t guarantee stable performance if not properly maintained. One of the keys to a high-performing Linux server is regular system monitoring, identifying potential issues early, and proper administration. These simple yet effective commands will help.
Here are 5 essential commands that should become part of your daily or weekly sysadmin routine, along with bonus tips for full control.
1. top — Real-Time Process Monitoring
The top command displays a list of active processes and provides an overview of system load:
top
You’ll see:
- CPU usage: great for spotting processes that are overloading the system.
- RAM usage: helps you understand if your system has enough resources.
- Most active processes: sortable by CPU or memory usage.
Pro tips:
- Press P to sort by CPU.
- Press M to sort by memory.
- Press k to kill a process (enter its PID).
Alternative:
- htop — a more user-friendly interface with colors, scrolling, and quick actions.
2. df -h — Check Disk Space Usage
A full disk can cause database errors, web server crashes, and even data loss. To avoid unexpected issues:
df -h
This shows:
- how much space is used on each partition;
- remaining free space;
- total disk sizes.
The -h flag stands for “human-readable” — showing sizes like 2.1G instead of 2210120.
Additional:
- du -sh /var/log/* — check which log files take up the most space.
Tip:
Clean logs regularly or set up automated log rotation with logrotate. This is especially useful for /var/log, where system logs accumulate.
3. uptime — Quick Server Stability Check
uptime
This command provides quick info about:
- Uptime — how long the server has been running without rebooting.
- Number of logged-in users.
- Average system load over the last 1, 5, and 15 minutes.
Helps determine server stability and detect performance spikes.
Example output:
17:05:42 up 14 days, 3:22, 2 users, load average: 0.14, 0.16, 0.19
4. journalctl -xe — View System Logs
When something goes wrong or works unpredictably — your first stop should be the logs. The journalctl -xe command shows the latest messages from the system journal with an emphasis on errors and warnings.
journalctl -xe
Extended options:
- journalctl -xe | grep ssh — filter messages related to SSH.
- journalctl -u nginx — log for a specific service (e.g., NGINX).
- journalctl -f — live mode (like tail -f).
Tip:
Also check /var/log/, especially syslog, auth.log, nginx/error.log, mysql/error.log — depending on your installed services.
5. netstat -tulnp — Check Open Ports
A security-focused command, netstat shows which ports are open and which programs use them. This helps detect unwanted or suspicious services.
netstat -tulnp
Explanation of flags:
- t — TCP connections.
- u — UDP connections.
- l — only listening ports.
- n — show IPs and ports numerically.
- p — show the PID and name of the process using the port.
Alternative:
- ss -tuln — a modern replacement for netstat, works faster and provides similar features.
Tip:
Scan your server regularly for open ports and compare with your firewall rules (ufw, iptables).
Bonus Command: du -sh * — Directory Size Overview
cd /var/www/
du -sh *
This command helps identify which folders take up the most space — useful when managing multiple sites or projects. Ideal for clean-up and optimization.
Extra Tips from a Sysadmin
1. Keep the System Updated
apt update && apt upgrade -y
Outdated software is a risk. Regularly update your kernel, libraries, control panels, and web servers.
2. Automate Backups
Set up automatic backups for databases, configs, and essential files.
3. Monitor Load
Tools like glances, netdata, and Zabbix help you see the full picture of your server’s health.
4. Secure SSH Access
- Disable root login.
- Change the default port (22).
- Use key-based authentication.
Summary
Even if you’re not a professional sysadmin, mastering these basic commands will let you:
- spot problems early;
- keep your VPS in shape;
- avoid downtimes and errors;
- save time and money on maintenance.
Managing your own project? Choose dedicated server rental or a VPS with transparent control. Need maximum reliability? Opt for server colocation in a data center.
And most importantly — don’t forget about security, SSL certificates, regular updates, and system monitoring. Your Linux server will reward you with speed, stability, and peace of mind.
Leave a Reply