How to know CPU frequency?

6,125

Solution 1

The command lscpu gives you info about your CPU.

To restrict the output to the frequency, use this command:

lscpu | grep MHz

The output looks something like

CPU MHz:               828.140
CPU max MHz:           3600.0000
CPU min MHz:           800.0000

and shows you your CPU's current frequency, its maximum frequency, and its minimum frequency.

You can also click onto "Details" in the system settings. There is an entry called "Processor" which shows you your processor's name. This name probably contains the rated CPU frequency. Example: Intel® Core™ i7-4720HQ CPU @ 2.60GHz × 8

Note that the maximum frequency lscpu can be higher than the rated frequency. This is due to Turbo Boost.

Solution 2

The first answer is a great one. The OP asked for "some" terminal commands. I'll throw in some extras, because every question can have many answers.

This is another way of seeing current frequencies for EVERY CPU:

rick@dell:~$  sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
[sudo] password for rick: 
2911523
2978173
2825097
3068554
2888232
2038769
2891894
3134619
────────────────────────────────────────────────────────────────
rick@dell:~$ 

You can shorten the above output by replacing * with a given CPU number such as 0 for the first CPU or 7 for the last CPU (on an 8 CPU system).

Another way of getting CPU frequencies without sudo powers is:

rick@dell:~$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
3174316
3223095
3250781
3214160
3211962
3222802
3237451
3245654
────────────────────────────────────────────────────────────────
rick@dell:~$ 

These are other commands in regards to Frequencies and the CPU that you might like to try out:

cat /sys/class/thermal/thermal_zone*/temp
cat /sys/devices/system/cpu/intel_pstate/no_turbo
cat /sys/devices/system/cpu/intel_pstate/turbo_pct
cat /sys/devices/system/cpu/intel_pstate/num_pstates
cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_min_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_transition_latency
cat /sys/devices/system/cpu/cpu*/cpufreq/affected_cpus
cat /sys/devices/system/cpu/cpu*/cpufreq/related_cpus
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors 
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed 
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver

Once again you can replace * with a given CPU number to shorten output.

Share:
6,125

Related videos on Youtube

Aleksey Timoshchenko
Author by

Aleksey Timoshchenko

I work as a programmer in one great company. I carry out a serious project on Android, a huge amount of valuable experience, constant research of new technologies and implementation of non-trivial tasks. I mastered a lot of technology libraries. You are welcome to Visit my web-page: https://alextimowenko.wixsite.com/android

Updated on September 18, 2022

Comments

  • Aleksey Timoshchenko
    Aleksey Timoshchenko over 1 year

    I'm running Ubuntu 16.04. How can I find out what frequency my computer's CPU has? I just need to know the CPU frequency according to the manufacturer and the real CPU frequency I have.

    Are there some terminal commands allowing that?

    EDIT

    There is output from lscpu

    CPU MHz:               1400.042
    CPU max MHz:           2700.0000
    CPU min MHz:           800.0000
    

    but from details i get another

    enter image description here

    the first output 2.7 and another 1.7 ...

    It is because of Turbo boost?

  • Byte Commander
    Byte Commander over 7 years
    Aww man. You were a few seconds faster than me... :P Have an upgoat.
  • Kroltan
    Kroltan over 7 years
    Conversely, lscpu can give low values for e.g. laptops running on battery, because the system intentionally declocks the hardware to preserve battery life, when there isn't anything using that time.
  • cat
    cat over 7 years
    You might consider noting that this type of file is exactly where lscpu reads from :)
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    @cat as does lm-sensors and many other third party tools. Indeed I didn't come up with all these examples on the spur of the moment they come from a LibreOffice Calc spreadsheet that runs these commands and returns the output to neighbouring cells. I've built up the list of commands over time reading websites. There are other sections for network, usb, nvidia, grub, etc. Well at least I used backticks this time ;)
  • oldtechaa
    oldtechaa over 7 years
    Why don't you just write bash scripts for those things? It'd be a lot easier on machines that don't have LibreOffice handy.
  • oldtechaa
    oldtechaa over 7 years
    @Kroltan, hopefully all processors since the P4/K8 era are being clocked down by Ubuntu, even desktops. The default cpufreq governor is ondemand.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    @oldtechaa I use LibreOffice to be a master controller of bash commands to find out everything about my system (that is of interest to me) and store the results (output) in the spreadsheet. If I put the commands in a bash script where would the output be stored so I can format it via drill down? I simply add interesting commands and run the spreadsheet from time to time which takes a few seconds to run hundreds of bash commands.
  • Aleksey Timoshchenko
    Aleksey Timoshchenko over 7 years
    I edited my question, you said about it? Turbo boost i mean
  • Kroltan
    Kroltan over 7 years
    @oldtechaa Ah, good to know. I only knew about laptop declocking, so I prefered to stay safe instead of mentioning something possibly incorrect. Thanks for the clarification!