___________ __________ _____ ________ ________ .____ ___________ \_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/ | __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_ | \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \ \___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ / \/ \/ \/ \/ \/ \/ \/

stress-ng Cheatsheet

← Back to cheatsheets

← Home


stress-ng is a system stress testing tool. Tests various system components including CPU, memory, I/O, disk, and network under load. Useful for system testing, benchmarking, and thermal testing.


Basic Usage

  • stress-ng --cpu <num> - Stress CPU with specified workers
  • stress-ng --vm <num> - Stress virtual memory
  • stress-ng --io <num> - Stress I/O
  • stress-ng --timeout <time> - Run for specified time
  • stress-ng --metrics-brief - Show brief metrics
  • stress-ng --verbose - Verbose output

CPU Stress

  • stress-ng --cpu <num> - Number of CPU workers
  • stress-ng --cpu-load <percent> - CPU load percentage
  • stress-ng --cpu-method <method> - CPU stress method
  • stress-ng --cpu-ops <num> - Stop after N operations

Memory Stress

  • stress-ng --vm <num> - Number of memory workers
  • stress-ng --vm-bytes <size> - Memory per worker
  • stress-ng --vm-method <method> - Memory stress method
  • stress-ng --vm-ops <num> - Stop after N operations

I/O Stress

  • stress-ng --io <num> - Number of I/O workers
  • stress-ng --hdd <num> - Stress hard disk
  • stress-ng --hdd-bytes <size> - Disk write size
  • stress-ng --hdd-ops <num> - Stop after N operations

Timing and Control

  • stress-ng --timeout <time> - Run for specified time
  • stress-ng --timeout <time>s - Time in seconds
  • stress-ng --timeout <time>m - Time in minutes
  • stress-ng --timeout <time>h - Time in hours
  • stress-ng --kill-after <time> - Kill after timeout

Output Options

  • stress-ng --metrics - Show metrics
  • stress-ng --metrics-brief - Brief metrics
  • stress-ng --verbose - Verbose output
  • stress-ng --quiet - Quiet mode
  • stress-ng --dry-run - Show what would be done

Common Examples

CPU Stress

stress-ng --cpu 4 --timeout 60s

Stress 4 CPUs for 60 seconds.

Memory Stress

stress-ng --vm 2 --vm-bytes 1G --timeout 30s

Stress memory with 2 workers, 1GB each, for 30 seconds.

I/O Stress

stress-ng --io 4 --timeout 60s

Stress I/O with 4 workers for 60 seconds.

Disk Stress

stress-ng --hdd 1 --hdd-bytes 1G --timeout 120s

Stress disk with 1GB writes for 120 seconds.

Combined Stress

stress-ng --cpu 2 --vm 1 --io 1 --timeout 60s

Stress CPU, memory, and I/O simultaneously.

With Metrics

stress-ng --cpu 4 --timeout 60s --metrics-brief

Show brief metrics during stress test.

CPU Load Percentage

stress-ng --cpu 4 --cpu-load 50 --timeout 60s

Stress CPUs at 50% load.

Verbose Output

stress-ng --cpu 2 --timeout 30s --verbose

Show detailed output.


Tips

  • Use --timeout to limit test duration
  • Use --metrics-brief to monitor performance during test
  • Start with low worker counts and short timeouts
  • Monitor system temperatures while running stress tests
  • Use watch sensors to monitor temperatures in real-time: watch -n 1 sensors
  • Use --cpu-load to control CPU utilization percentage
  • Use --vm-bytes to control memory stress size
  • Use --dry-run to see what would be executed
  • Essential for thermal testing and system stability verification