The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Monitor system CPU and memory

To monitor system CPU and memory usage, there are several tools and methods available depending on your operating system. Here’s how to do it across common platforms:


Windows

1. Task Manager

  • Press Ctrl + Shift + Esc or right-click the taskbar and choose Task Manager.

  • Under the Performance tab, you can view:

    • CPU Usage: Current load, speed, number of cores.

    • Memory Usage: Total, available, in use.

2. Resource Monitor

  • Open Run (Win + R), type resmon and press Enter.

  • Go to the CPU and Memory tabs for detailed insights.

3. Command Line

cmd
wmic cpu get loadpercentage systeminfo | findstr /C:"Total Physical Memory"

macOS

1. Activity Monitor

  • Found in /Applications/Utilities/Activity Monitor.

  • Displays real-time CPU and memory usage per process and system-wide.

2. Terminal

bash
top -l 1 | grep "CPU usage" vm_stat

You can also use htop if installed via Homebrew:

bash
brew install htop htop

Linux (Ubuntu, CentOS, etc.)

1. top / htop

bash
top

Or with htop (requires installation):

bash
sudo apt install htop # Debian/Ubuntu sudo yum install htop # RHEL/CentOS htop

2. vmstat

bash
vmstat 1

3. free –m

Shows memory in MB:

bash
free -m

4. mpstat (from sysstat)

bash
sudo apt install sysstat mpstat -P ALL 1

5. ps command

To check top CPU or memory consuming processes:

bash
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

Cross-Platform Python Script

If you want to build a custom monitor:

python
import psutil import time while True: print("CPU Usage:", psutil.cpu_percent(interval=1), "%") mem = psutil.virtual_memory() print("Memory Usage:", mem.percent, "%") time.sleep(1)

Install psutil with:

bash
pip install psutil

System Monitoring Tools

  • Grafana + Prometheus: Advanced, real-time dashboards.

  • Nagios: Enterprise-grade monitoring.

  • Glances (Cross-platform):

bash
pip install glances glances

Use these tools depending on your needs—quick checks via top, detailed GUI with Task/Activity Monitor, or persistent tracking with Grafana or custom scripts.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About