Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Monitor CPU Frequency in Linux Using Command Line Tools

Monitoring CPU frequency is crucial for understanding the performance and power consumption of your Linux system. In Linux, you can easily check and manage CPU frequency using various command-line tools. This article will guide you through the process of monitoring and adjusting CPU frequency in a Linux environment.

Examples:

  1. Using lscpu:
    The lscpu command provides detailed information about the CPU architecture, including its frequency.

    lscpu | grep "MHz"

    This command will display the current CPU frequency in megahertz (MHz).

  2. Using /proc/cpuinfo:
    The /proc/cpuinfo file contains information about the CPU, including its frequency.

    cat /proc/cpuinfo | grep "MHz"

    This command will list the frequency of each CPU core.

  3. Using cpufreq-info:
    The cpufreq-info command, part of the cpufrequtils package, provides detailed information about CPU frequency scaling.

    First, install cpufrequtils if it's not already installed:

    sudo apt-get install cpufrequtils

    Then, run:

    cpufreq-info

    This command will give you detailed information about the current frequency, available governors, and more.

  4. Adjusting CPU Frequency with cpufreq-set:
    You can also adjust the CPU frequency using cpufreq-set. This is useful for power management and performance tuning.

    For example, to set the CPU to a specific frequency:

    sudo cpufreq-set -f 1.2GHz

    Or to set the CPU governor to "performance" for maximum frequency:

    sudo cpufreq-set -g performance

    To set it back to "ondemand" for dynamic frequency scaling:

    sudo cpufreq-set -g ondemand
  5. Using watch with lscpu:
    To continuously monitor CPU frequency, you can use the watch command with lscpu.

    watch -n 1 "lscpu | grep 'MHz'"

    This command will update the CPU frequency information every second.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.