Common Linux Stress Testing and Performance Monitoring Commands
This article introduces a variety of Linux command‑line tools used for stress testing and performance monitoring, covering CPU, memory, disk, network, processes, load, temperature and other utilities with brief usage examples and practical tips.
Stress testing is an important method for evaluating system stability and performance, especially concerning network latency and concurrent access volume. The Linux operating system provides rich built‑in command‑line tools that allow simple and reliable stress testing. This article introduces commonly used Linux stress testing commands.
CPU related commands:
top : real‑time display of overall system performance.
htop : interactive process viewer providing detailed process and system performance information.
mpstat : shows average utilization of each available processor.
sar : reports historical system activity data, including CPU usage, load, I/O, etc.
Memory related commands:
free : displays system memory usage.
vmstat : provides statistics on memory, CPU, disk, and swap space.
smem : reports detailed memory usage information, including process and kernel memory occupancy.
pmap : shows the memory map of a process.
Disk related commands:
df : shows file system disk space usage.
df -h : same as above with human‑readable sizes.
du : estimates file and directory disk space usage.
du -sh <目录路径> : summarizes disk usage of a directory in human‑readable format.
iostat : reports statistics on system disk I/O activity.
fuser : shows processes using a specified file or file system.
fuser -v <文件路径> : verbose output of processes using a file.
Network related commands:
netstat : displays network connections, routing tables, interface statistics, etc.
netstat -a : shows all connections and listening ports.
ss : provides detailed socket statistics.
ss -s : summary of socket statistics.
iftop : real‑time display of bandwidth usage on network interfaces.
iftop -n : same without hostname resolution.
tcpdump : captures and analyzes network packets.
tcpdump -i <接口> -n : captures packets on a specified interface without name resolution.
Process related commands:
ps : displays status of active processes.
ps aux : detailed view of all processes.
top : real‑time display of process CPU, memory, I/O usage.
pgrep <进程名称> : finds process IDs by name.
pkill <进程名称> : terminates processes by name.
Load related commands:
uptime : shows system average load and uptime.
w : displays logged‑in users and system load.
top : real‑time display of system load and process information.
Temperature related commands:
sensors : shows hardware sensor temperature and voltage information.
hddtemp : displays hard disk temperature.
hddtemp /dev/sda : temperature of the specified disk.
Other related commands:
lsof : lists open files and associated processes.
strace : traces system calls and signals of a process.
strace <命令> : runs strace on a given command.
dmesg : displays kernel ring buffer messages.
sar : reports historical system activity data, including CPU, memory, disk, network, etc.
uptime : shows system average load and uptime.
Note that this is only a subset of commonly used commands for viewing server performance information; actual output may vary across Linux distributions and versions. It is recommended to select appropriate commands based on actual needs and consult their help documentation for more options and usage.
Test Development Learning Exchange
Test Development Learning Exchange
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.