Read CPU performance counters

Count CPU cycles, instructions and cache misses while a command runs (here sleep 5). Add -a to cover the whole system.

perf stat -e cycles,instructions,cache-misses -- sleep 5

tool
linux133 commands
tags
linuxmonitoringperformance

More linux commands

  • lscpu | grep -E 'Model|Socket|Core|Thread|MHz'

    Show the CPU model, how sockets, cores and threads are laid out, and the clock speed.

  • dmidecode -t memory | grep -E 'Size|Speed|Locator|Type:'

    Show physical DIMM slots with size, speed and type (needs root).

  • lspci -v | grep -A5 'VGA\|Ethernet\|NVMe'

    Show network cards, GPUs and NVMe controllers with driver info.

  • chattr +i /etc/resolv.conf && lsattr /etc/resolv.conf

    Nobody, not even root, can change the file until the flag is removed with chattr -i. Good for when something keeps rewriting resolv.conf behind your back.

  • lsattr -R /etc/ 2>/dev/null | grep -v '^\-\-\-\-'

    List files in /etc/ that have non-default attributes.

all 133 linux commands