266

Is there any way to check at which clock speed my processor is running?

I have already tried cat /proc/cpuinfo but the clock speed I'm running isn't showing. I know Ubuntu 12.04 (Precise Pangolin) requires 700 MHz and VGA, but will an AMD Mobile Sempron work?

2
  • You need more specific on the second part of your question. Do you know the model number?
    – LiveWireBT
    Nov 20, 2012 at 6:55
  • Thank you for all the answers but I am good now! Nov 20, 2012 at 23:04

20 Answers 20

292

From the command line type lscpu. The information will be at CPU MHz:

~$ lscpu | grep MHz
CPU MHz:               804.901
CPU max MHz:           3200.0000
CPU min MHz:           800.0000
5
  • 14
    Note that the value of CPU MHz is not fixed and may change by the second.
    – Cerin
    Jan 30, 2014 at 15:53
  • 2
    Is there something like that embedded into something like htop? Something similar to Performance Monitor in Windows?
    – Royi
    Oct 4, 2020 at 11:39
  • 1
    @Royi watch "(lscpu | grep MHz)" Aug 2, 2021 at 10:24
  • grep Hz to also find GHz Mar 28, 2023 at 12:47
  • 2
    lscpu did not show freq for me. cat /proc/cpuinfo | grep MHz worked
    – Hritik
    Aug 8, 2023 at 4:00
226

There are a couple of ways:

  1. lscpu or more precise lscpu | grep "MHz".
    This will give you the general MHz for the CPU.

     $ lscpu | grep "MHz".
     CPU MHz:               1600.000
    
  2. cat /proc/cpuinfo or more precise cat /proc/cpuinfo | grep "MHz".
    This will give you the individual MHz for each CPU Core. So if you have an Core 2 Duo, AMD Bulldozer, Core i7, etc.. it will show the MHz for each core.

    $ cat /proc/cpuinfo | grep "MHz"
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 3400.000
    
  3. lshw -c cpu or more precise version: lshw -c cpu | grep capacity
    Will give you the general MHz. Same as lscpu.

    $ lshw -c cpu | grep capacity
    WARNING: you should run this program as super-user.
           capacity: 1600MHz
    WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
    
  4. sudo dmidecode -t processor or more precise: sudo dmidecode -t processor | grep "Speed" Will not only give you a MHz in use but also the Maximum you can push / overclock your CPU to.

     $ sudo dmidecode -t processor | grep Speed
     [sudo] password for cyrex: 
         Max Speed: 4000 MHz
         Current Speed: 2666 MHz
    

Out of all of this, lshw and dmidecode provide the best information out of your CPU.

You can also target the current MHz detected by the kernel by querying the log files:

cat /var/log/dmesg | grep "MHz processor" - For the current detected MHz speed

cat /var/log/kern.log | grep "MHz processor" - For the current and past detected MHz speeds. Will not work in some cases, that is why I posted the dmesg one first.

And that's all I can remember from the top of my head. I am fairly certain there are other ways, just don't remember right now. Of course, talking about terminal ways.

Note: All the commands above will also give you the CURRENT cpu Hertz, meaning, if you expect to see the same one on lscpu and when doing the cat /proc/cpuinfo it will be near impossible. you CAN compare the maximum because that should show the same for any of the ways you can analyze the CPU, but the current will always be literally "the current CPU hertz" at the moment you execute it. Lastly do note that dmidecode reads information from the ACPI tables which is not always the same as the real time ones done by the other tools.

9
  • 1
    For me, all options except dmidecode gave a false reading: I'm overclocking an intel E6600 2.4ghz chip on a gigabyte ga-965p-ds3 3.3 board with 7x multiplier & 400mhz CPU frequency to give 2.8ghz CPU, but the stock multiplier is 9 (9x266=2.4ghz) so I suspect the rest of the tools assume multiplier is stock and times that by the CPU mhz, so in my case they all give 3.6ghz.
    – dez93_2000
    Oct 31, 2014 at 22:30
  • 3
    dmidecode seems to be the only one to accurately report the clock speed when overclocking Mar 1, 2017 at 22:45
  • 4
    lscpu gives me max and min frequency, but not the current one. cat /proc/cpuinfo tell me lots of stuff about my ARM cores, but no frequency at all. lshw doesn't exist. dmidecode -t processor gives me an unhandled fault. Those may work on your PC, but not on my embedded linux. cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq is the way to go.
    – Philippos
    May 3, 2017 at 14:32
  • 3
    dmidecode doesn't seem to work, it shows the CPU stuck at max frequency, which is not accurate, I'm pretty sure. powertop and lscpu show the actual variable frequency.
    – Rolf
    Jan 28, 2018 at 5:08
  • 3
    You don't need to cat /path/to/file | grep "some string" - you can just grep the file directly instead: grep "some string" /path/to/file. Awesome answer, though.
    – mgarey
    Apr 2, 2019 at 21:43
112

For the current CPU speed one can dynamically watch this change in real time using:

sudo watch -n 1  cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq

To see the maximum CPU speed, use:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq 
7
  • 5
    +1, I know this is an Ubuntu site, but this appears to be the only answer providing a command that is completely OS independent.
    – Andy E
    Apr 24, 2014 at 11:53
  • 13
    cpufreq/cpuinfo_cur_freq doesn't exist
    – Ken Sharp
    Aug 5, 2016 at 23:51
  • 1
    +1, even on several ARM-based systems running Ubuntu only this solution works. Each and every other "solutions" given on this page fail there, while this works everywhere.
    – Philippos
    May 9, 2017 at 6:24
  • 8
    On my system I need to use scaling_cur_freq as the filename, not cpuinfo_cur_freq which no longer seems to exist. So the full command is: cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq Dec 22, 2017 at 12:15
  • 5
    intel_pstate CPU freq driver doesn't provide cpuinfo_cur_freq. cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver to see what driver is currently used. BTW, cpuinfo_cur_freq is hardware's point of view and scaling_cur_freq is kernel's point of view of the current CPU frequency. More on static.lwn.net/kerneldoc/admin-guide/pm/… Dec 28, 2017 at 11:38
19

indicator-cpufreq-selector is a nice little indicator tool which shows your current CPU frequency. You can even select the desired CPU frequency.

enter image description here

However, the last update for this tool was on 2021-05-28.

5
  • 5
    You can install it using sudo apt-get install indicator-cpufreq.
    – Wilf
    Feb 26, 2014 at 23:00
  • 2
    And after installing, you'll need to reboot before it will show up.
    – talyric
    Mar 30, 2015 at 19:39
  • 2
    Doesn't work well in newer Ubuntus, if at all.
    – Ken Sharp
    Aug 5, 2016 at 23:51
  • Where does it show the 'desired cpu frequency'??
    – france1
    Apr 29, 2022 at 11:43
  • @france1 The little dot next to the options indicates the current desired frequency. Click on other options to switch. Aug 10, 2023 at 12:03
15

This works fine for real-time processor speeds

 watch "grep 'cpu MHz' /proc/cpuinfo"

While this is active, you can also spam the processor to see what maximum real-time speeds it can reach by openssl speed

9

I would just like to add i7z to this list. Contrary to the other options, this works better for CPUs in the i7, i5 and i3 series that have TurboBoost.

2
  • Exactly what I needed. And it also shows Vcore voltages, Turbo multipliers, C0 halts, etc. Very nice! Mar 11, 2018 at 12:56
  • 3
    Heads up, requires 30mb of ruby and assorted tools. Jun 5, 2018 at 2:38
9

This is my favorite:

watch -n1 "grep 'MHz' /proc/cpuinfo"

Although if you have Turbo Boost (or Turbo Core if AMD), you may prefer the following, which uses cpupower from the linux-tools group:
* On my system, both work equally well though.

sudo watch -n 1 -d cpupower monitor

Thanks @Zanna for point out the useless use of cat in the comments.

0
8

I'd like to point out sudo is needed for Ian's answer above:

sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq

However you can get the same results without sudo using:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq

My favourite is to use Conky where you can paint your own picture:

Conky.gif

This sits on the right of my built-in display all the time. The relevant code for the CPU section is:

${color2}${voffset 5}Intel® i-7 3630QM 3.4 GHz: ${color1}@  ${color green}${freq} MHz   
${color}${goto 13}CPU 1 ${goto 81}${color green}${cpu cpu1}% ${goto 131}${color3}${cpubar cpu1 18}
${color}${goto 13}CPU 2 ${goto 81}${color green}${cpu cpu2}% ${goto 131}${color3}${cpubar cpu2 18}
${color}${goto 13}CPU 3 ${goto 81}${color green}${cpu cpu3}% ${goto 131}${color3}${cpubar cpu3 18}
${color}${goto 13}CPU 4 ${goto 81}${color green}${cpu cpu4}% ${goto 131}${color3}${cpubar cpu4 18}
${color}${goto 13}CPU 5 ${goto 81}${color green}${cpu cpu5}% ${goto 131}${color3}${cpubar cpu5 18}
${color}${goto 13}CPU 6 ${goto 81}${color green}${cpu cpu6}% ${goto 131}${color3}${cpubar cpu6 18}
${color}${goto 13}CPU 7 ${goto 81}${color green}${cpu cpu7}% ${goto 131}${color3}${cpubar cpu7 18}
${color}${goto 13}CPU 8 ${goto 81}${color green}${cpu cpu8}% ${goto 131}${color3}${cpubar cpu8 18}
${color1}All CPU ${color green}${cpu}% ${goto 131}${color1}Temp: ${color green}${hwmon 2 temp 1}°C ${goto 250}${color1}Up: ${color green}$uptime
6
  • 3
    Where is Conky and what is it?
    – not2qubit
    Apr 19, 2018 at 5:57
  • 2
    @not2qubit I'll update this answer later but in the meantime see this Arch Linux article: wiki.archlinux.org/index.php/conky Apr 19, 2018 at 10:03
  • Is there something like that built in for Ubuntu?
    – Royi
    Oct 4, 2020 at 11:22
  • @Royi Like most Ubuntu applications you can install conky with sudo apt install. Then you design your system monitor display anyway you like. I built mine using bits and pieces of examples others have for conky. You can do a google search on conky to see what's out there. Oct 4, 2020 at 14:29
  • Are there pre defined recipes?
    – Royi
    Oct 4, 2020 at 16:42
5

If you are using an embedded ARM device (such as a Raspberry or ARM based phones), you will not be able to use solutions using lscpu, dmidecode or /proc/cpuinfo because the current speed is not listed there, if the tool is at all available. Instead you have to use sysfs:

alias getcpuf='i=1; for x in $(sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq); do y=$(($x/1000)); echo "CPU-${i}: $y MHz"; i=$((i+1)); done;'

# getcpuf
CPU-1: 600 MHz
CPU-2: 600 MHz
CPU-3: 600 MHz
CPU-4: 600 MHz
4

sudo powertop then hit Tab twice to get to the "Frequency stats" tab.

It displays Actual frequency (accurate on my Laptop, as opposed to dmidecode), along with stats about how long is spent in each available frequency.

2
  • Does it have a specific line for the current frequency? Looks to just show the % of time each frequency + idle state is "active", no indication of which is active right now?
    – Xen2050
    Dec 23, 2018 at 1:07
  • 1
    @Xen2050 CPU frequency can change back and forth within milliseconds, so I'm more interested in statistics. You can run powertop -t 1 for a low delay, so that stats will be updated every second.
    – Rolf
    Dec 23, 2018 at 12:30
3
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
1
  • This does not show the current frequency
    – france1
    Apr 29, 2022 at 11:46
3

Here is a straightforward way to get cpu frequencies for all CPU threads:

  1. Be sure that cpufrequtils is installed.

  2. Then in a terminal, run the following command:

    cpufreq-info | grep "frequency is"
    
2

In a terminal, enter:

cat /proc/cpuinfo | grep name

It should display the exact model of your CPU.

This Wikipedia page on the Sempron will give you detailed specifications.

1
  • 2
    This does not show the current cpu frequency
    – france1
    Apr 29, 2022 at 11:46
2

I wanted to share this as a comment, but dont have many reputations on askubuntu, People who want to use indicator-cpufreq do not need to reboot the computer. Resetting the current X session is enough to display the icon.

sudo apt-get install indicator-cpufreq   
DISPLAY=:0 compiz --replace

You can validate the Performance and Powersave option by seeing the current frequency by

watch -d "cat /proc/cpuinfo | grep -i Mhz"

As soon as you click on a lower frequency / Powersave, the powermanagement of the CPU kicks in, thereby reducing the clock cycle.

1
  • The user logging out & in again (but not rebooting) would probably work as well
    – Xen2050
    Dec 23, 2018 at 1:08
2

In a Linux terminal type the following command to get the CPU core name and it's current speed:

cat /proc/cpuinfo | grep -E "model name|cpu MHz";

1

The gnome tweak Vitals shows to my mind more accurately to 2.5 (even 2.7Ghz) of my Ryzen 2500, others showed 2Gz. ( pdfsandwich OCR'ing a pdf file is a good tester as it maxes out all CPUs)

https://extensions.gnome.org/extension/1460/vitals/

1

Please note that /proc/cpuinfo contains wrong values. Because of that I use this:

watch -n2 "cpufreq-info | grep 'current CPU'"

Result: enter image description here

And here the wrong result of /proc/cpuinfo: enter image description here

1

Ubuntu 22.04 no longer provides the current CPU speed in lscpu without the extra flags -ae so to get the average cpu speed I have a cpuspeed script in /usr/local/bin/:

data=`lscpu -ae | cut -c 61-69 | grep -iv MHz`
total=0.001
count=0
while read -r line
do
    total=`awk "BEGIN {z=$total + $line; print z}"`
    let count+=1
done <<< $data
avg=`echo $total / $count | bc`
echo $avg

All it does is print out the average cpu speed in MHz. If you want to continually monitor it, call it from watch.

Whilst I like i7z this produces the number without having to install anything or having lots of other stuff around it.

(assigning 0.001 to total is my hack to ensure that the floating point math works and I'm sure everyone will criticise me for have three different math methods in 3 lines! Please don't bash my Bash)

0

Sample output of cat /proc/cpuinfo

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 774.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 1600.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 2
apicid      : 1
initial apicid  : 1
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 2
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 800.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 1
cpu cores   : 2
apicid      : 2
initial apicid  : 2
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 774.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 1
cpu cores   : 2
apicid      : 3
initial apicid  : 3
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

Here cpu MHz means current cpu frequency. You can run cpufreq-info to understand easily.

1
0

run command sudo i7z, the benefit of this command is it will tell real time cpu frequency with other information like temperature as well.I used to use sensors for temperature but it showed one time temperature. This command start a process with shows real time information.

1
  • 1
    This same utility was suggested by someone else in an answer from five years ago 🤐
    – matigo
    Jun 29, 2021 at 3:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .